React Native 不变违例:requireNativeComponent:在UIManager中未找到“RNSScreenNavigationContainer”

1hdlvixo  于 2023-05-01  发布在  React
关注(0)|答案(1)|浏览(369)

当我在iOS上使用Expo Go应用程序运行React Native应用程序时,它运行起来没有问题,但是当我在Android上使用Expo Go应用程序运行它时,会发生错误。

Invariant Violation: requireNativeComponent: "RNSScreenNavigationContainer" was not found in the UIManager.
    This error is located at:
    in RNSScreenNavigationContainer (created by ScreenContainer)
    in ScreenContainer (created by MaybeScreenContainer)
    in MaybeScreenContainer (created by DrawerView)
    in RCTView (created by View)
    in View (created by DrawerView)
    in RCTView (created by View)
    in View (created by AnimatedComponent(View))
    in AnimatedComponent(View)
    in Unknown (created by DrawerView)
    in RCTView (created by View)
    in View (created by AnimatedComponent(View))
    in AnimatedComponent(View)
    in Unknown (created by PanGestureHandler)
    in PanGestureHandler (created by PanGestureHandler)
    in PanGestureHandler (created by DrawerView)
    in DrawerView (created by DrawerViewBase)
    in DrawerViewBase (created by DrawerView)
    in RNGestureHandlerRootView (created by GestureHandlerRootView)
    in GestureHandlerRootView (created by DrawerView)
    in RNCSafeAreaProvider (created by SafeAreaProvider)
    in SafeAreaProvider (created by SafeAreaInsetsContext)
    in SafeAreaProviderCompat (created by DrawerView)
    in DrawerView (created by DrawerNavigator)
    in PreventRemoveProvider (created by NavigationContent)
    in NavigationContent
    in Unknown (created by DrawerNavigator)
    in DrawerNavigator (created by App)
    in EnsureSingleNavigator
    in BaseNavigationContainer
    in ThemeProvider
    in NavigationContainerInner (created by App)
    in App (created by withDevTools(App))
    in withDevTools(App)
    in RCTView (created by View)
    in View (created by AppContainer)
    in RCTView (created by View)
    in View (created by AppContainer)
    in AppContainer
    in main(RootComponent), js engine: hermes
    at node_modules\react-native\Libraries\Core\ExceptionsManager.js:null in reportException
    at node_modules\react-native\Libraries\Core\ExceptionsManager.js:null in handleException
    - ... 7 more stack frames from framework internals

我删除并安装了react-native-screens应用程序,删除并重新安装了node_modules目录和yarn。锁定。

qij5mzcb

qij5mzcb1#

只需检查安装库的所有必要步骤,然后从本机平台android studioXcode运行代码。
如果上面的方法对你不起作用,请删除node-modulespods文件夹。然后运行下面的代码

npm install or yarn install
cd ios 
pod install

现在从本机平台再次运行。

相关问题