react-native-emoji-input icon indicating copy to clipboard operation
react-native-emoji-input copied to clipboard

Editing emoji file

Open prasanthsd opened this issue 4 years ago • 4 comments

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?

prasanthsd avatar Jun 19 '20 09:06 prasanthsd

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

rijn avatar Jul 01 '20 06:07 rijn

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?

prasanthsd avatar Jul 01 '20 06:07 prasanthsd

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 ?

mauscoelho avatar Dec 24 '20 15:12 mauscoelho

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

prasanthsd avatar Dec 24 '20 15:12 prasanthsd