TheWidlarzGroup / rn-emoji-keyboard

Super performant, lightweight, fully customizable emoji picker 🚀
https://thewidlarzgroup.github.io/rn-emoji-keyboard/
MIT License
323 stars 55 forks source link

fix: infinite loop on category swipe #167

Closed AnMiZa closed 5 months ago

AnMiZa commented 5 months ago

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

Changes:


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 commented 5 months ago

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.