nuclearpasta / react-native-drax

A drag-and-drop system for React Native
MIT License
554 stars 69 forks source link

gesture-handler-2.0 #166

Closed LunatiqueCoder closed 1 year ago

LunatiqueCoder commented 1 year ago

Solves #140

While it works very well with LunatiqueCoder/expo-drax-example (which is forked from: nuclearpasta/react-native-drax-example) , we managed to reproduce in production this particular issue: https://github.com/software-mansion/react-native-gesture-handler/issues/2674.

As described in the above link and also in #165, this happens when there are a lot of GestureDetectors from the new gesture-handler API. Reducing the number of GestureDetectors (or DraxViews in our case) will make the issue less annoying or even very hard to reproduce.

I believe this should stay as a draft until we manage to fix it OR we can try to have a useLegacyGestureHandler prop.

While I also had to add some type guards, here are the actual changes:

LunatiqueCoder commented 1 year ago

We firstly implemented react-native-reanimated with the goal of changing as little source code as possible. You can see a video here: https://x.com/LunatiqueCoder/status/1721982083902394694?s=20

Then when we also upgraded gesture-handler we ran into this issue: https://github.com/software-mansion/react-native-gesture-handler/issues/2674 so we decided to isolate the changes related to gesture-handler in order to create a reproduction repository. However, upon further investigation, we realised there's a possibility of fixing this issue on our end as gesture-handler is designed to function more seamlessly with reanimated than standalone. Ugh, this is going to be fun. Closing this in favour of another upcoming reanimated PR.