skip to Main Content

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.

2

Answers


  1. Chosen as BEST ANSWER

    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


  2. It is mandatory to wrap your code with that tag:

    <GestureHandlerRootView>
          <Component />
    </GestureHandlerRootView>
    

    Then, you can wrap your main component on App.js with that tag so every animation inside it will work.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search