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: categories index change #179

Closed danielmark0116 closed 2 months ago

danielmark0116 commented 2 months ago

Issue

After recent changes, whenever a user changes the category using the category icons one by one (quickly), picker would change category's index twice (e.g. 0->1->2->1->2 whereas it should only be 0->1->2) - 1) in onPress handler on a category icon and 2) with onMomentumScroll handler.

Fix

Category needs to be changed only with one method at a time thus skipping onMomentumScrollEnd handler whenever the momentum did not start helped (adding additional onMomentumScrollBegin handler was required)

Steps to reproduce the issue

  1. open an emoji picker with category icons either on top or bottom
  2. change category by pressing a category icon
  3. quickly repeat it with another category

Before:

https://github.com/TheWidlarzGroup/rn-emoji-keyboard/assets/44443723/2429fdf6-147c-4d50-b477-079631511c27

After:

https://github.com/TheWidlarzGroup/rn-emoji-keyboard/assets/44443723/45405415-c44a-4a37-9de2-39ad2129ab5d

Android is functioning ok as well:

https://github.com/TheWidlarzGroup/rn-emoji-keyboard/assets/44443723/44197349-b1be-4231-8bdc-a50194d0bd9f