sskhandek / react-native-emoji-input

A fully-featured emoji keyboard ⌨️ for React Native ⚛️
MIT License
71 stars 38 forks source link

Editing emoji file #48

Open prasanthsd opened 4 years ago

prasanthsd commented 4 years ago

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?

rijn commented 4 years ago

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
prasanthsd commented 4 years ago

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?

mauscoelho commented 3 years ago

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 ?

prasanthsd commented 3 years ago

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