emoji-picker-react icon indicating copy to clipboard operation
emoji-picker-react copied to clipboard

Custom Emoji not render

Open chatGPTxx opened this issue 1 year ago • 4 comments

First thanks so much for the great component! I'm using it in my react nextjs app, I added customEmojis in the "EmojiPicker" component. It works fine when emoji picker pops up and I can select my custom emojis. But when I use the selected custom emoji in "Emoji" by passing the unified value, it doesn't show. Only workaround I found is to show EmojiPicker once. But the issue with the workaround is it will then download all emojis which slows down my app. Could you please advise?

chatGPTxx avatar Feb 20 '24 09:02 chatGPTxx

The custom emojis are in my /public/emojis folder, I set the custom emoji imgUrl as '/emojis/custom.png'

chatGPTxx avatar Feb 20 '24 09:02 chatGPTxx

I see. Yes. This seems to be correct. I did not think of this use case. The reason is that the picker initially adds all the custom emojis to the global emojis map, otherwise, there is not much way for it to actually look it up by unified code.

In such a scenario, there might be some prep work on your end that would need to be done, such as: loadCustomEmojis(...), do it once on app load, and it should behave the same. would such a solution work for you? If so, I will work on it during the weekend.

ealush avatar Feb 20 '24 22:02 ealush

Thanks for your quick response! I tried to download custom emojis to client side before initializing "EmojiPicker" I can see custom.png downloaded successfully from browser dev tool. But somehow they still can't be recognized by "Emoji" component.

Do you have recommended way to implement loadCustomEmojis? Or I will wait for your improvement when you get time.

chatGPTxx avatar Feb 21 '24 05:02 chatGPTxx

Hi @ealush ,do you have plan when will you improve it? Or please kindly guide me how can I do it at my end. Thanks!

chatGPTxx avatar Mar 12 '24 06:03 chatGPTxx