software-mansion / react-native-gesture-handler

Declarative API exposing platform native touch and gesture system to React Native.
https://docs.swmansion.com/react-native-gesture-handler/
MIT License
5.83k stars 952 forks source link

Add check when removing handlers from orchestrator #2831

Closed m-bert closed 1 month ago

m-bert commented 1 month ago

Description

2819 removed changes made in #2802. After further investigation we found out that removeHandlerFromOrchestrator didn't check if handlers were present in orchestrator, therefore in some situation calling this function ended up in removing wrong handler. Calling indexOf returned -1 and, as you can read in docs:

Negative index counts back from the end of the array

So instead of ignoring that, we simply removed wrong handler.

Test plan

Tested on example app (mostly on swipeable example) and example code from #2819