react-nativeexporeact-navigation-drawerreact-native-gesture-handler

Render Error requireNativeComponent: "RNGestureHandlerRootView" was not found in the UIManager


Help me to fix this error.

Render Error requireNativeComponent: "RNGestureHandlerRootView" was not found in the UIManager.

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

This error is located at:in RNGestureHandlerRootView (created by GestureHandlerRootView)in GestureHandlerRootView (created by DrawerView)in RCTView (created by View)in View in SafeAreaProviderCompat (created by DrawerView)in DrawerView (created by DrawerNavigator)in Unknown (created by DrawerNavigator)in DrawerNavigator (created by DrawerNavigator)in DrawerNavigator (created by SceneView)in StaticContainerin EnsureSingleNavigator (created by SceneView)in SceneView (created by SceneView)in RCTView (created by View)in View (created by DebugContainer)in DebugContainer (created by MaybeNestedStack)in MaybeNestedStack (created by SceneView)in RNSScreen (created by AnimatedComponent)in AnimatedComponent in AnimatedComponentWrapper (created by Screen)in MaybeFreeze (created by Screen)in Screen (created by SceneView)in SceneView (created by NativeStackViewInner)in RNSScreenStack (created by ScreenStack)in ScreenStack (created by NativeStackViewInner)in NativeStackViewInner (created by NativeStackView)in RNCSafeAreaProvider (created by SafeAreaProvider)in SafeAreaProvider in SafeAreaProviderCompat (created by NativeStackView)in NativeStackView (created by NativeStackNavigator)in Unknown (created by NativeStackNavigator)in NativeStackNavigator (created by AuthStack)in AuthStack (created by App)in EnsureSingleNavigator in BaseNavigationContainer in ThemeProviderin NavigationContainerInner (created by App)in App (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

This error occurs when I try to add a Drawer Navigator to the android application that I am implementing using React-Native. I run npm install --save react-native-gesture-handler and add import "react-native-gesture-handler"; on top of my root file. But the same error occurs.

Versions:

"react-native": "0.64.3", "react-native-gesture-handler": "^2.3.2", "react-navigation-drawer": "^2.7.2", "react-native-reanimated": "^2.4.1",


Solution

  • Maybe you forgot to wrap your app in this:

    export default function App() {
      return (
        <GestureHandlerRootView>
          {/* content */}
        </GestureHandlerRootView>;
      )
    }
    

    Friendly reminder to always read installation docs. I feel like you didn't do that but I am sorry if I am wrong. Here is the link to the react-native-gesture-handler installation doc: https://docs.swmansion.com/react-native-gesture-handler/docs/installation