Search code examples
reactjsreact-nativeexpo

Error: NativeViewGestureHandler must be used as a descendant of GestureHandlerRootView


I've installed GestureHandler (npx expo install react-native-gesture-handler) and also imported it into my App.tsx file on line 3 with polyfills

import 'react-native-gesture-handler';

was doing it by the Expo Docs and for some reason it still doesn't seem to be working even after running npx expo start --clear (to clear cache) it will gives me this error:

Error: NativeViewGestureHandler 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.

Solution

  • Okay so turned out I am dumb and I imported TouchableOpacity from react-native-gesture-handler instead of react-native 😅 sorry but maybe might help someone so just posting the solution here :) happy coding