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

Empty emojis #194

Open
dehimer opened this issue Oct 28, 2024 · 6 comments
Open

Empty emojis #194

dehimer opened this issue Oct 28, 2024 · 6 comments
Labels
bug Something isn't working

Comments

@dehimer
Copy link

dehimer commented Oct 28, 2024

Describe the bug
I am using 1.7.0 version with 0.71.8 react native version. Repeatable on real iOS device (iPhone 12 mini) and in sumulator.
Opened picker displaying non visible list of emojis. But categories bar is displayed and switching between categories changes nothing. Something at first open all fine - I see list of emojis. But next openings on other screens with problem.

To Reproduce
Steps to reproduce the behavior:

  1. Open picker as usual
  2. No emojis in picker

Expected behavior
Stable displaying of set of emojis

Screenshots
Снимок экрана 2024-10-28 в 14 34 23

Smartphone (please complete the following information):

  • iOS 17.2 on simulator (iPhone 12 mini)
  • iOS 18.0.1 on real iPhone 12 mini
@dehimer dehimer added the bug Something isn't working label Oct 28, 2024
@dehimer
Copy link
Author

dehimer commented Oct 28, 2024

I am tried next also without success:

  1. Made single instance of component in Root component
  2. Rendering of component only if state is open

@efstathiosntonas
Copy link

efstathiosntonas commented Oct 28, 2024

@dehimer this is probably an onLayout not working well

probably this line:

onLayout={(e) => setWidth(e.nativeEvent.layout.width)}

can you navigate to node_modules to that file and set a static width eg. 300?

@dehimer
Copy link
Author

dehimer commented Oct 28, 2024

Found a string with problem
171: const flatListData = data.slice(0, maxIndex)
in EmojiCategory.tsx file

Somehow maxIndex is 0

If I remove .slice part - all works fine. Will look further and prepare MR

@dehimer
Copy link
Author

dehimer commented Oct 28, 2024

So, found a problem

// with InteractionManager we can show emojis after interaction is finished
    // It helps with delay during category change animation
    InteractionManager.runAfterInteractions(() => {
      if (maxIndex === 0 && data.length) {
        setMaxIndex(minimalEmojisAmountToDisplay)
      }
    })

is not running next times

So locally replaced it by:

React.useEffect(() => {
      const task = requestAnimationFrame(() => {
        if (maxIndex === 0 && data.length) {
          console.log('### setMaxIndex#1', maxIndex, data.length)
          setMaxIndex(minimalEmojisAmountToDisplay)
        }
      })
      return () => cancelAnimationFrame(task)
    }, [])

Now working good

@dehimer
Copy link
Author

dehimer commented Oct 28, 2024

Here a fix #195

@dehimer
Copy link
Author

dehimer commented Oct 28, 2024

@dehimer this is probably an onLayout not working well

probably this line:

onLayout={(e) => setWidth(e.nativeEvent.layout.width)}

can you navigate to node_modules to that file and set a static width eg. 300?

Sorry, saw your message too late

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants