react-native-emoji-input
react-native-emoji-input copied to clipboard
Editing emoji file
Hi,
The documentation just states to edit the file and compile using this command.
npx babel-node scripts/compile.js
I installed @babel/node and @babel/core first. In node 10 as well as 12 it didn't work. On node 10 it says "SyntaxError: Unexpected token import" and on node 12 its "SyntaxError: Cannot use import statement outside a module". Is it possible for someone to provide some help on how to get this compiled?
What command you used to compile? The error should only happen when running untranspiled code. babel default preset should transpile the es6 module to require. You could also manually specify the preset.
npx babel-node --presets @babel/preset-env scripts/compile.js
I already fixed it with preset-env. But then there are syntax errors in index.js like "concat" function missing and I realized it was using a concat on an object instead of an array. Commented that out and fixed a few other stuff in the code to get that working. But I have a feeling the index.js inside emoji-data may not be the latest one. Can you please confirm?
I followed the same steps but looks like the compiled.js
file is not correct and I got an error on searching the emojis.
Did you manage to make it works @prasanthsd ?
From my notes it seems I fixed it by the following changes:
Use @babel/preset-env
In index.js comment out the following:
emojiSynonyms[k].concat(userInputEmojiSynonyms[k])
.invert()
.map((v, idx) => ({
"keywords": v,
"emoji_key": idx
}))
Then run npx babel-node scripts/compile.js