React Native 呈现错误必需本机组件:在UI管理器中找不到“RNGestureHandlerRootView”

mrwjdhj3  于 2023-02-09  发布在  React
关注(0)|答案(2)|浏览(467)

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",

ruyhziif

ruyhziif1#

您可能忘记将应用打包在以下内容中:

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

友情提示请务必阅读安装文档。我觉得你没有这样做,但如果我错了,我很抱歉。下面是react-native-gesture-handler安装文档的链接:https://docs.swmansion.com/react-native-gesture-handler/docs/installation

uelo1irk

uelo1irk2#

如果您安装并按照有关抽屉导航的所有步骤操作,并保持相同的结果,那么您必须使用npx react-native run-android -- --reset-cache重建应用程序,以防万一卸载应用程序。

相关问题