运行react-native应用程序并获取错误不变违规:requireNativeComponent:在UIManager中找不到“RNSScreenStackHeaderConfig”

问题描述 投票:0回答:1

尝试了所有方法后,当我尝试使用 npx expo start 运行 Expo 应用程序时,仍然遇到持续错误。错误信息如下:

ERROR Invariant Violation: requireNativeComponent: "RNSScreenStackHeaderConfig" was not found in the UIManager.
This error is located at:
  in RNSScreenStackHeaderConfig (created by ScreenStackHeaderConfig)
  in ScreenStackHeaderConfig (created by HeaderConfig)
  in HeaderConfig (created by SceneView)
  in RNSScreen (created by Animated(Anonymous))
  in Animated(Anonymous)
  in Suspender (created by Freeze)
  in Suspense (created by Freeze)
  in Freeze (created by DelayedFreeze)
  in DelayedFreeze
  in InnerScreen (created by Screen)
  in Screen (created by SceneView)
  in SceneView (created by NativeStackViewInner)
  in Suspender (created by Freeze)
  in Suspense (created by Freeze)
  in Freeze (created by DelayedFreeze)
  in DelayedFreeze (created by ScreenStack)
  in RNSScreenStack (created by ScreenStack)
  in Unknown (created by ScreenStack)
  in ScreenStack (created by NativeStackViewInner)
  in NativeStackViewInner (created by NativeStackView)
  in RCTView (created by View)
  in View (created by SafeAreaProviderCompat)
  in SafeAreaProviderCompat (created by NativeStackView)
  in NativeStackView (created by NativeStackNavigator)
  in PreventRemoveProvider (created by NavigationContent)
  in NavigationContent
  in Unknown (created by NativeStackNavigator)
  in NativeStackNavigator (created by MainStack)
  in MainStack (created by App)
  in ThemeProvider (created by PaperProvider)
  in RCTView (created by View)
  in View (created by Portal.Host)
  in Portal.Host (created by PaperProvider)
  in RCTView (created by View)
  in View (created by SafeAreaInsetsContext)
  in SafeAreaProviderCompat (created by PaperProvider)
  in PaperProvider (created by App)
  in ContextProvider (created by AppDataProvider)
  in AppDataProvider (created by App)
  in ContextProvider (created by NavigationContextProvider)
  in NavigationContextProvider (created by App)
  in ContextProvider (created by AuthProvider)
  in AuthProvider (created by App)
  in EnsureSingleNavigator
  in BaseNavigationContainer
  in ThemeProvider
  in NavigationContainerInner (created by App)
  in Provider (created by App)
  in I18nextProvider (created by App)
  in RCTView (created by View)
  in View (created by GestureHandlerRootView)
  in GestureHandlerRootView (created by App)
  in RNCSafeAreaView
  in Unknown (created by App)
  in RNCSafeAreaProvider (created by SafeAreaProvider)
  in SafeAreaProvider (created by App)
  in App (created by RootApp)
  in ReactNativeProfiler (created by RootApp)
  in RCTView (created by View)
  in View (created by __Sentry.TouchEventBoundary)
  in __Sentry.TouchEventBoundary (created by RootApp)
  in RootApp (created by withDevTools(RootApp))
  in withDevTools(RootApp)
  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

详情: 我尝试了各种解决方案,但没有解决该错误。我的应用程序正在使用 React Native 和 Expo。我怀疑这个问题可能与依赖项不兼容有关,但我不确定是哪一个。

我的设置: 以下是 package.json 中我的依赖项的摘要:

    "dependencies": {
    "@config-plugins/react-native-callkeep": "^8.0.0",
    "@config-plugins/react-native-webrtc": "^9.0.0",
    "@gorhom/bottom-sheet": "^5.0.5",
    "@notifee/react-native": "^9.1.2",
    "@react-native-async-storage/async-storage": "^1.24.0",
    "@react-native-community/datetimepicker": "^8.2.0",
    "@react-native-community/netinfo": "^11.4.1",
    "@react-native-community/slider": "^4.5.5",
    "@react-native-firebase/analytics": "^19.0.0",
    "@react-native-firebase/app": "^19.0.0",
    "@react-native-firebase/auth": "^19.0.0",
    "@react-native-firebase/crashlytics": "^19.0.0",
    "@react-native-firebase/firestore": "^19.0.0",
    "@react-native-firebase/functions": "^19.0.0",
    "@react-native-firebase/messaging": "^19.0.0",
    "@react-native-firebase/remote-config": "^19.0.0",
    "@react-native-firebase/storage": "^19.0.0",
    "@react-navigation/material-top-tabs": "^7.0.1",
    "@react-navigation/native": "^6.1.18",
    "@react-navigation/native-stack": "^6.9.20",
    "@react-navigation/stack": "^6.4.1",
    "@reduxjs/toolkit": "^2.3.0",
    "@rneui/themed": "^4.0.0-rc.8",
    "@sentry/react-native": "^5.35.0",
    "async": "^3.2.6",
    "babel-plugin-module-resolver": "^5.0.2",
    "console-table-printer": "^2.12.1",
    "currency-master": "^1.1.0",
    "expo": "~51.0.28",
    "expo-av": "^14.0.7",
    "expo-camera": "^16.0.4",
    "expo-contacts": "^13.0.5",
    "expo-dev-client": "^4.0.29",
    "expo-device": "^6.0.2",
    "expo-image-manipulator": "^12.0.5",
    "expo-image-picker": "^15.0.7",
    "expo-linking": "^6.3.1",
    "expo-localization": "^15.0.3",
    "expo-location": "^17.0.1",
    "expo-media-library": "^16.0.5",
    "expo-notifications": "^0.28.19",
    "expo-splash-screen": "^0.27.6",
    "expo-status-bar": "~1.12.1",
    "expo-updates": "^0.25.27",
    "firebase": "^11.0.1",
    "i18next-intervalplural-postprocessor": "^3.0.0",
    "intl-pluralrules": "^2.0.1",
    "jssip": "^3.10.1",
    "libphonenumber-js": "^1.11.14",
    "moment": "^2.30.1",
    "moment-timezone": "^0.5.46",
    "patch-package": "^8.0.0",
    "react": "18.2.0",
    "react-i18next": "^15.1.1",
    "react-native": "0.74.5",
    "react-native-android-finish": "^1.2.1",
    "react-native-background-timer": "^2.4.1",
    "react-native-bouncy-checkbox": "^4.1.2",
    "react-native-callkeep": "^4.3.14",
    "react-native-copilot": "^3.3.2",
    "react-native-fast-image": "^8.6.3",
    "react-native-flash-message": "^0.4.2",
    "react-native-gesture-handler": "^2.20.0",
    "react-native-image-viewing": "^0.2.2",
    "react-native-incall-manager": "^4.2.0",
    "react-native-linear-gradient": "^2.8.3",
    "react-native-masked-text": "^1.13.0",
    "react-native-modal": "^13.0.1",
    "react-native-paper": "^5.12.5",
    "react-native-permissions": "^5.1.0",
    "react-native-reanimated": "^3.16.1",
    "react-native-restart": "^0.0.27",
    "react-native-safe-area-context": "^4.11.1",
    "react-native-screens": "^3.29.0",
    "react-native-share": "^11.0.4",
    "react-native-shimmer-placeholder": "^2.0.9",
    "react-native-sound": "^0.11.2",
    "react-native-svg": "^15.8.0",
    "react-native-uuid": "^2.0.3",
    "react-native-vision-camera": "^4.6.1",
    "react-native-webrtc": "^124.0.4",
    "react-redux": "^9.1.2",
    "text-encoding": "^0.7.0",
    "use-context-selector": "^2.0.0"
  },

我已完成的步骤:

  1. 删除了node_modules和package-lock.json
  2. 删除了 Pod 和 Podfile.lock
  3. npm cache clean --force
  4. npm install
  5. pod install
  6. npx expo start --clear
  7. 升级/降级相关库,如
    react-native-screens
    react-navigation

问题:

  • 依赖项不匹配是否会导致此问题?
  • 是否存在与react-native-screens或其他已知的不兼容性 导航相关的库?
  • 我可以采取哪些额外步骤来解决此问题?

任何指导将不胜感激!

react-native expo react-navigation react-native-screens
1个回答
0
投票

我通过升级我的

package.json
中的相关导航依赖项解决了这个问题。这是解决问题的依赖项的更新版本:

"@react-navigation/native": "^7.0.0",
"@react-navigation/native-stack": "^6.11.0",
"@react-navigation/stack": "^7.0.0",
© www.soinside.com 2019 - 2024. All rights reserved.