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

fix: infinite loop on category swipe #167

Closed
wants to merge 1 commit into from
Closed

fix: infinite loop on category swipe #167

wants to merge 1 commit into from

Conversation

AnMiZa
Copy link
Contributor

@AnMiZa AnMiZa commented Feb 4, 2024

This PR fixes infinite loop on quick emoji list scroll behavior reported in issue

Changes:

  • moved logic for scrolling emoji categories from useEffect hook to separate method
  • passed it into handleScrollToCategory method in Categories component

In the previous implementation, after scrolling between EmojiCategories using gesture, when setActiveCategory was called inside onScrollEnd method, useEffect callback with scrollToIndex was fired with activeCategoryIndex that the list was already at. Quick scrolling back and forth with gesture was causing infinite state updates between current and previous activeCategoryIndexes. To fix that behavior while leaving ability to browse EmojiCategories using CategoryItem press scrollToIndex is now called directly inside CategoryItem

@AnMiZa AnMiZa closed this Feb 4, 2024
@AnMiZa AnMiZa deleted the fix/infiniteLoopOnCategorySwiping branch February 4, 2024 14:18
@AnMiZa
Copy link
Contributor Author

AnMiZa commented Feb 4, 2024

I closed this PR due to wrong git config on my side. As I didn't want to alter Your git history with weird hacks I decided to fix issue on my side and open new PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants