You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
jestSetup does not mock useEnsureGestureHandlerRootView, so v3 GestureDetector throws in Jest #4657
After the Jest setup from the testing guide (jestSetup.js and transformIgnorePatterns), rendering a v3 GestureDetector fails with:
GestureDetector must be used as a descendant of GestureHandlerRootView. Otherwise the gestures will not be recognized.
useEnsureGestureHandlerRootView throws when DEV is true, there is no root view context, and Platform.OS !== 'web'. In Jest, DEV is true and Platform.OS is ios. jestSetup.js mocks HostGestureDetector but not this hook.
Expected: either jestSetup.js mocks the hook, or the testing guide says to wrap test renders in GestureHandlerRootView.
Steps to reproduce
Install react-native-gesture-handler 3.3.0 in a project with Jest and @testing-library/react-native.
Add import "react-native-gesture-handler/jestSetup" to the Jest setup file, as the guide says.
Render this component in a test, with no GestureHandlerRootView around it:
Activity
m-bert commentedon Nov 2, 2026
Hi @MrCordeiro! can you confirm that approach from #4660 works in your case?
MrCordeiro commentedon Nov 2, 2026
Hi @m-bert ! Just tested and it worked!