Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Performance improvement idea (to be discussed) #152

Open
jan-kozinski opened this issue Aug 9, 2023 · 8 comments
Open

Performance improvement idea (to be discussed) #152

jan-kozinski opened this issue Aug 9, 2023 · 8 comments
Labels
enhancement New feature or request question Further information is requested

Comments

@jan-kozinski
Copy link

Hi, we've been getting some performance issues reports lately, so I wanted to discuss a possible improvement regarding how we render the emojis.

Current solution

As of now, each category of emojis is built with a Flatlist component where each item is a single emoji.

Suggested solution

the renderItem callback of the flatlist could render whole rows of emojis at once, thus having less items to render, and less elements in the React DOM (since entire row will be kept in a single Text element). Then, the onClick callback of each row might check the X position of the touch gesture and determine which emoji the user tapped based on this X position value.

Possible problems

  • various emojis have different widths. We would need to find a way to have a fixed width for emojis using text justification and/or letter spacing, which may come off as hard to accomplish.
  • the performance improvement may be insignificant (I'm still getting onboarded with the repo so I don't know what the bottlenecks are)

@mateki0 @jakex7 WDYT? (others are also more than welcome to enter the discussion :))

@jan-kozinski jan-kozinski added enhancement New feature or request question Further information is requested labels Aug 9, 2023
@jakex7
Copy link
Collaborator

jakex7 commented Aug 9, 2023

Hi, unfortunately it will be quite hard, if not impossible to implement due to selectedEmojis feature and related to that indications

@jan-kozinski
Copy link
Author

WDYM? What does the selectedEmojis indicate? Are the emojis growing wider when multi-selected or is there some sophisticated animation going on?

@shanoysinc
Copy link

I am currently using an iPhone 11 pro and the start-up for the emoji picker is quite slow the animation is really laggy.
what animation/ bottom sheet library are you using?
is the app loading all the emojis at once?

@jakex7
Copy link
Collaborator

jakex7 commented Sep 24, 2023

WDYM? What does the selectedEmojis indicate? Are the emojis growing wider when multi-selected or is there some sophisticated animation going on?

@jan-kozinski As it is described in the documentation, dev can pass an array of selectedEmojis as props to indicate the emojis

https://thewidlarzgroup.github.io/rn-emoji-keyboard/docs/documentation/Examples/selected_emojis

image

@jakex7
Copy link
Collaborator

jakex7 commented Sep 24, 2023

I am currently using an iPhone 11 pro and the start-up for the emoji picker is quite slow the animation is really laggy. what animation/ bottom sheet library are you using? is the app loading all the emojis at once?

@shanoysinc I am sorry to hear that. We are constantly working to improve performance. Does your issue also occur in the production build?

@shanoysinc
Copy link

yes in the production build but when I use the emoji picker in my own modal and not the bottom sheet modal the performance is great @jakex7

@jan-kozinski
Copy link
Author

jan-kozinski commented Sep 29, 2023

hmm @jakex7
My idea is that the list item component will be a single row component, that has selectedEmojisIndexes in its state, and renders the indications as absolutely positioned divs with zIndex lower than the <Text> tag with emojis. The indications don't need a flatlist of their own and can use map function, since if a row is rendered than so are all the indications
Would it solve the issue?

@wadefleming-nz
Copy link

I am sometimes seeing that the keyboard pops up but the emojis only appear after a delay - is this one of the 'performance issues' under consideration?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request question Further information is requested
Projects
None yet
Development

No branches or pull requests

4 participants