[Bug]: [v5]GestureDetector must be used as a descendant of GestureHandlerRootView
Version
v5
Reanimated Version
v3
Gesture Handler Version
v2
Platforms
iOS, Android
What happened?
Error: GestureDetector must be used as a descendant of GestureHandlerRootView. Otherwise the gestures will not be recognized. See https://docs.swmansion.com/react-native-gesture-handler/docs/installation for more details.
Plataform: IOS, Android
On Web works fine
Reproduction steps
- When trigger the event to show de component BottomSheet crash the app.
Reproduction sample
https://snack.expo.dev/@franamu/bottom-sheet---issue-reproduction-template
Relevant log output
GestureDetector must be used as a descendant of GestureHandlerRootView. Otherwise the gestures will not be recognized. See https://docs.swmansion.com/react-native-gesture-handler/docs/installation for more details.
On web works fine:
I got it too. any solution?
Update:- I missed one step to wrap app with these
<GestureHandlerRootView>
<BottomSheetModalProvider>
{app}
</BottomSheetModalProvider>
</GestureHandlerRootView>
Now working fine
I have the same problem
@fabricioferiozzi96 Your <BottomSheetProvider> is not a child of <GestureHandlerRootView style={{ flex: 1 }}>
i have updated the docs to include GestureHandlerRootView with every example
https://gorhom.dev/react-native-bottom-sheet/usage
@gorhom @rajangargsmartdata thank you! works fine in all plataforms, but the behavior is different nonetheless.
Without GestureHandlerRootView (I need this behavior)
https://github.com/user-attachments/assets/f19ea66e-2a06-40e1-bf8c-d5bd7d9c92c1
With GestureHandlerRootView:
https://github.com/user-attachments/assets/1eb63ad0-9a11-42d8-b38a-477b01ceee24
If I change the color, it's the same because the GestureHandlerRootView container doesn't leave until bottomSheetRef.current?.close(); event finishes.
@gorhom thanks for all the work on the library!
I just stumbled across this error and I believe it was because in the modal usage example the order of the BottomSheetModalProvider and GestureHandlerRootView is swapped. Works fine once I corrected that. I wanted to point that out incase the documentation does indeed need to be updated to remove confusion.
https://gorhom.dev/react-native-bottom-sheet/modal/usage
this is happening again. The GestureRootHandlerView is at the root. I am running RN 0.81.4 and the latest rnbottomsheet 5.2.6