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

Virtualize emoji list #299

Open onlyahost opened 1 year ago

onlyahost commented 1 year ago

I know there was some discussion about this here and I am new to the repository. I hope I don't open an issue which was discussed before but the Github search didn't give me any results regarding this, so I will give it a shot.

Our case We are using the picker in an animated dropdown (CSS transitions of opacity and transform when mounting the dropdown). In cases like that the browser is animating and trying to render the whole emoji list at once which causes quite some lag. Lazy loading is taking some load off loading the images but it still needs to render the whole DOM tree.

Possible solution I think it would be fairly beneficial to virtualise the emoji list. Instead of using a library I think it would be enough to place a shared Intersection Observer on the Emojis (as they all have the same height it's not that much logic to write). If you didn't try that yet or have any strong opinion against it I might do an implementation and do a PR?

ealush commented 1 year ago

Hey @onlyahost, I personally do not have anything in particular against virtualization, and what was right for v3 (when my previous comment was made) may not be right for v4, since I wrote the picker completely from scratch recently.

I would love to see the picker's performance being improved using any means-virtualization included. I didn't give virtualization much thought in recent version, but here's what I think may require some creative thinking:

I'd say, have a stab at it. I am willing to offer my help if this does indeed seem like something that's plausible.

phuctm97 commented 1 year ago

I'd love to upvote this as well, I have the same use case as @onlyahost and it is consistently causing noticeable lag even on a Macbook Pro M1. Native virtualization would be improve the experience a lot.

manuthecoder commented 1 year ago

+1

I am also experiencing a noticeable lag on my Windows PC, not to mention my chromebook and phone.

chavda-bhavik commented 11 months ago

+1

chavda-bhavik commented 11 months ago

@ealush I would like to work on it, to hit the performance. Do you have any library preferences for it?

ealush commented 11 months ago

Sure, @chavda-bhavik, go ahead. In terms of library, I'll only allow a native solution.

Most virtualization library are not suitable for this specific need, and I've if they do, they bring with them other features that we're not interested in.

Instead, let's try to come up with something that would want without adding any dependencies