ealush / emoji-picker-react

The most popular React Emoji Picker
https://ealush.com/emoji-picker-react/
MIT License
1.04k stars 171 forks source link

Export emoji data #349

Open 777PolarFox777 opened 1 year ago

777PolarFox777 commented 1 year ago

Hello! Is there a chance you could export emoji data from src/data/emojis.ts? I would like to use it to show emoji popup when typing : character.

Currently, I'm importing a json directly from the package but it leads to duplication and my bundle contains 2 copies of emoji data. That increases bundle size a lot.

Would be really nice to use the exported version so I could get rid of the duplicates)

777PolarFox777 commented 1 year ago

Another solution could be removing emoji data from the index entry point) That would work as well)

SeanDunford commented 1 year ago

Piggy backing off of this bc i was looking for something similar. If this was implemented i could implement the search myself but it would be even better for my use case if there was a way to search for an emoji to validate it's renderable. Example below.


const data = { unifiedEmoji: 'badTextInDb' };
const unified = emojiByUnified(data.unified) ? data.unified : '1f60a'; // Use a default 

  <Emoji
  unified={unified}
  emojiStyle={EmojiStyle.APPLE}
  size={22}
/>

Alternatively a fallback option would also be nice.

const data = { unifiedEmoji: 'badTextInDb' };

  <Emoji
  unified={unified}
  fallBackEmoji={'smile'} // Could be unified or whatever but if unified fails then render this instead
  emojiStyle={EmojiStyle.APPLE}
  size={22}
/>

Forgive me if there's an existing solution to this just started using the library.

jeffreyclu commented 12 months ago

Hello! Is there a chance you could export emoji data from src/data/emojis.ts? I would like to use it to show emoji popup when typing : character.

Currently, I'm importing a json directly from the package but it leads to duplication and my bundle contains 2 copies of emoji data. That increases bundle size a lot.

Would be really nice to use the exported version so I could get rid of the duplicates)

Seconding this request for the exact same usecase