19

I need to fix this error.

Invariant Violation: requireNativeComponent: "RNGestureHandlerRootView" was not found in the UIManager.

This error is located at: in RNGestureHandlerRootView (created by GestureHandlerRootView) in GestureHandlerRootView (created by StackView) in StackView (created by StackView) in StackView in Unknown (created by Navigator) in Navigator (created by SceneView) in SceneView (created by SwitchView) in SwitchView (created by Navigator) in Navigator (created by NavigationContainer) in NavigationContainer (created by ExpoRoot) in ExpoRoot in RCTView (created by View) in View (created by AppContainer) in RCTView (created by View) in View (created by AppContainer) in AppContainer

7 Answers7

37

Recently I had the same problem. Here's the solution:

expo install react-native-gesture-handler

and

import 'react-native-gesture-handler';

On the root of the Project, the App.js file probably.

Try to use the documentation, it can be found here, and it's how I resolved this issue: https://reactnavigation.org/docs/getting-started/

Lucas Fernandes
  • 522
  • 5
  • 11
  • 6
    I have done as mentioned by you, but still not able to solve this issue. any further help you can do? – JPithwa Apr 17 '22 at 10:59
  • Doing this solved my issue, but still unclear why this component is required when I have not used it in my app at all. Is this an issue with React Native Expo – Muhammad Abdullah Nabeel Jan 10 '23 at 12:20
16

1. Update dependencies with expo

On an existing Expo project some dependencies versions installed by you may be incompatible with Expo. This causes such errors. To fix this issue you need the right versions of those dependencies. Run the following command to remove the incompatible versions and install the supported versions as required by Expo.

expo update

Confirm the action with Y if it prompts your approval. Then restart your app. This will fix the issue.

2. Install required dependencies

If you don't have react-native-gesture-handler installed in your project, install it.

  • If you install it with expo you may not require to follow the step 1 above.
expo install react-native-gesture-handler

  • But if you install it through npm or yarn you also need to follow the step 1 above.
npm install react-native-gesture-handler
  • To import it in App.js/ App.tsx, place it in the first line of the file, or use as required:
import 'react-native-gesture-handler';
cigien
  • 57,834
  • 11
  • 73
  • 112
TradeCoder
  • 1,832
  • 3
  • 7
  • 18
1

In my case, i had to clear cache by runing:

expo start --clear

After trying the other solutions and not working.

NingaCodingTRV
  • 312
  • 2
  • 7
0

react native error [1]: https://i.stack.imgur.com/czCTX.png

sole my side this code

expo install react-native-gesture-handler

Vipin Chauhan
  • 94
  • 1
  • 2
  • 3
    As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Mar 24 '22 at 13:45
  • 1
    This answer already given: https://stackoverflow.com/a/71398125/5468463. Why do you repeat? – Vega Apr 29 '22 at 09:38
0

A solution I found out if you are using expo ,run the command line expo update in your terminal. It fixes all the wrong dependencies and installs the correct packages.

Shawn Lee
  • 11
  • 3
0

what worked for me - i have delete all the node modules

$ npm install -g remove-node-modules

then insalled it again

 $ npm install
jmoerdyk
  • 5,544
  • 7
  • 38
  • 49
0

Following the steps to install dependencies with expo install and put the "import" line in App.js, I realized this still doesn't work in previously built standalone app. However, it works in Expo Go.

The error is from RN Fabric not able to recognize the native component, as it's not registered in the UIManager from the native side. To do that a new build of native code is required. I assume that's why previously built standalone app won't work. However, I am not sure why the Expo Go app would work -- one possible reason is that those dependencies are pre-bundled to the Expo Go native app already.

Xin Chen
  • 263
  • 2
  • 11