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
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.
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 insideonScrollEnd
method,useEffect
callback withscrollToIndex
was fired withactiveCategoryIndex
that the list was already at. Quick scrolling back and forth with gesture was causing infinite state updates between current and previousactiveCategoryIndex
es. To fix that behavior while leaving ability to browse EmojiCategories using CategoryItem pressscrollToIndex
is now called directly insideCategoryItem