React native 不变冲突:requirenActiveComponent:“;RNCSAFearView“;在UIManager中找不到。在expo应用程序中使用react native
所以在我的工作场所,我们在expo上有一个传统的react原生应用程序。我使用android模拟器进行调试,它用于android设备上的内部工作人员。 我们有几个月没碰它了,当我们试图重建时,我们遇到了一个错误。我不得不升级所有的库,因为大多数库都不推荐使用 代码如下:React native 不变冲突:requirenActiveComponent:“;RNCSAFearView“;在UIManager中找不到。在expo应用程序中使用react native,react-native,expo,react-navigation,react-native-safe-area-view,React Native,Expo,React Navigation,React Native Safe Area View,所以在我的工作场所,我们在expo上有一个传统的react原生应用程序。我使用android模拟器进行调试,它用于android设备上的内部工作人员。 我们有几个月没碰它了,当我们试图重建时,我们遇到了一个错误。我不得不升级所有的库,因为大多数库都不推荐使用 代码如下: import * as React from "react"; import { Text, View } from "react-native"; import { NavigationContainer } from "@r
import * as React from "react";
import { Text, View } from "react-native";
import { NavigationContainer } from "@react-navigation/native";
import { createStackNavigator } from "@react-navigation/stack";
function Demo() {
return (
<View
style={{ flex: 1, justifyContent: "space-between", alignItems: "center" }}
>
<Text>This is top text.</Text>
<Text>This is bottom text.</Text>
</View>
);
}
const Stack = createStackNavigator();
export default function App() {
return (
<NavigationContainer>
<Stack.Navigator initialRouteName="Home" headerMode="none">
<Stack.Screen name="Settings" component={Demo} />
</Stack.Navigator>
</NavigationContainer>
);
}
完全错误是:
Invariant Violation: requireNativeComponent: "RNCSafeAreaView" was not found in the UIManager.
This error is located at:
in RNCSafeAreaView (at src/index.tsx:26)
in SafeAreaProvider (at SafeAreaProviderCompat.tsx:42)
in SafeAreaProviderCompat (at StackView.tsx:428)
in RCTView (at View.js:45)
in View (at StackView.tsx:427)
in StackView (at createStackNavigator.tsx:82)
in StackNavigator (at App.js:123)
in EnsureSingleNavigator (at BaseNavigationContainer.tsx:309)
in ForwardRef(BaseNavigationContainer) (at NavigationContainer.tsx:64)
in ThemeProvider (at NavigationContainer.tsx:63)
in ForwardRef(NavigationContainer) (at App.js:122)
in App (at withExpoRoot.js:20)
in RootErrorBoundary (at withExpoRoot.js:19)
in ExpoRootComponent (at renderApplication.js:35)
in RCTView (at View.js:45)
in View (at AppContainer.js:98)
in RCTView (at View.js:45)
in View (at AppContainer.js:115)
in AppContainer (at renderApplication.js:34) handleException @ ExceptionsManager.js:74 showErrorDialog @ ReactNativeRenderer-dev.js:14654 logCapturedError @ ReactNativeRenderer-dev.js:14664 logError @ ReactNativeRenderer-dev.js:14770 callback @ ReactNativeRenderer-dev.js:15907 callCallback @ ReactNativeRenderer-dev.js:13857 commitUpdateEffects @ ReactNativeRenderer-dev.js:13901 commitUpdateQueue @ ReactNativeRenderer-dev.js:13892 commitLifeCycles @ ReactNativeRenderer-dev.js:15122 commitAllLifeCycles @ ReactNativeRenderer-dev.js:16635 invokeGuardedCallbackImpl @ ReactNativeRenderer-dev.js:93 invokeGuardedCallback @ ReactNativeRenderer-dev.js:318 commitRoot @ ReactNativeRenderer-dev.js:16875 (anonymous) @ ReactNativeRenderer-dev.js:18501 unstable_runWithPriority @ scheduler.development.js:653 completeRoot @ ReactNativeRenderer-dev.js:18498 performWorkOnRoot @ ReactNativeRenderer-dev.js:18427 performWork @ ReactNativeRenderer-dev.js:18324 performSyncWork @ ReactNativeRenderer-dev.js:18285 requestWork @ ReactNativeRenderer-dev.js:18169 scheduleWork @ ReactNativeRenderer-dev.js:17969 scheduleRootUpdate @ ReactNativeRenderer-dev.js:18642 updateContainerAtExpirationTime @ ReactNativeRenderer-dev.js:18676 updateContainer @ ReactNativeRenderer-dev.js:18765 render @ ReactNativeRenderer-dev.js:19512 renderApplication @ renderApplication.js:61 run @ AppRegistry.js:103 runApplication @ AppRegistry.js:198
__callFunction @ MessageQueue.js:366 (anonymous) @ MessageQueue.js:106
__guard @ MessageQueue.js:314 callFunctionReturnFlushedQueue @ MessageQueue.js:105 (anonymous) @ debuggerWorker.js:80 Show 3 more frames ExceptionsManager.js:82 Invariant Violation: Invariant Violation: requireNativeComponent: "RNCSafeAreaView" was not found in the UIManager.
This error is located at:
in RNCSafeAreaView (at src/index.tsx:26)
in SafeAreaProvider (at SafeAreaProviderCompat.tsx:42)
in SafeAreaProviderCompat (at StackView.tsx:428)
in RCTView (at View.js:45)
in View (at StackView.tsx:427)
in StackView (at createStackNavigator.tsx:82)
in StackNavigator (at App.js:123)
in EnsureSingleNavigator (at BaseNavigationContainer.tsx:309)
in ForwardRef(BaseNavigationContainer) (at NavigationContainer.tsx:64)
in ThemeProvider (at NavigationContainer.tsx:63)
in ForwardRef(NavigationContainer) (at App.js:122)
in App (at withExpoRoot.js:20)
in RootErrorBoundary (at withExpoRoot.js:19)
in ExpoRootComponent (at renderApplication.js:35)
in RCTView (at View.js:45)
in View (at AppContainer.js:98)
in RCTView (at View.js:45)
in View (at AppContainer.js:115)
in AppContainer (at renderApplication.js:34)
at invariant (blob:http://localhost:19003/96ae467f-40fc-4feb-b794-9cac89e35617:7493:17)
at getNativeComponentAttributes (blob:http://localhost:19003/96ae467f-40fc-4feb-b794-9cac89e35617:62205:5)
at blob:http://localhost:19003/96ae467f-40fc-4feb-b794-9cac89e35617:21723:14
at Object.exports.get (blob:http://localhost:19003/96ae467f-40fc-4feb-b794-9cac89e35617:45693:20)
at createInstance (blob:http://localhost:19003/96ae467f-40fc-4feb-b794-9cac89e35617:29809:56)
at completeWork (blob:http://localhost:19003/96ae467f-40fc-4feb-b794-9cac89e35617:36915:34)
at completeUnitOfWork (blob:http://localhost:19003/96ae467f-40fc-4feb-b794-9cac89e35617:39074:32)
at performUnitOfWork (blob:http://localhost:19003/96ae467f-40fc-4feb-b794-9cac89e35617:39237:18)
at workLoop (blob:http://localhost:19003/96ae467f-40fc-4feb-b794-9cac89e35617:39247:30)
at renderRoot (blob:http://localhost:19003/96ae467f-40fc-4feb-b794-9cac89e35617:39313:13) reactConsoleErrorHandler @ ExceptionsManager.js:82
__expoConsoleLog @ RemoteConsole.js:80 console.error @ YellowBox.js:59 error @ muteWarnings.fx.js:26 componentDidCatch @ RootErrorBoundary.js:56 proxiedMethod @ createPrototypeProxy.js:44 callback @ ReactNativeRenderer-dev.js:15908 callCallback @ ReactNativeRenderer-dev.js:13857 commitUpdateEffects @ ReactNativeRenderer-dev.js:13901 commitUpdateQueue @ ReactNativeRenderer-dev.js:13892 commitLifeCycles @ ReactNativeRenderer-dev.js:15122 commitAllLifeCycles @ ReactNativeRenderer-dev.js:16635 invokeGuardedCallbackImpl @ ReactNativeRenderer-dev.js:93 invokeGuardedCallback @ ReactNativeRenderer-dev.js:318 commitRoot @ ReactNativeRenderer-dev.js:16875 (anonymous) @ ReactNativeRenderer-dev.js:18501 unstable_runWithPriority @ scheduler.development.js:653 completeRoot @ ReactNativeRenderer-dev.js:18498 performWorkOnRoot @ ReactNativeRenderer-dev.js:18427 performWork @ ReactNativeRenderer-dev.js:18324 performSyncWork @ ReactNativeRenderer-dev.js:18285 requestWork @ ReactNativeRenderer-dev.js:18169 scheduleWork @ ReactNativeRenderer-dev.js:17969 scheduleRootUpdate @ ReactNativeRenderer-dev.js:18642 updateContainerAtExpirationTime @ ReactNativeRenderer-dev.js:18676 updateContainer @ ReactNativeRenderer-dev.js:18765 render @ ReactNativeRenderer-dev.js:19512 renderApplication @ renderApplication.js:61 run @ AppRegistry.js:103 runApplication @ AppRegistry.js:198
__callFunction @ MessageQueue.js:366 (anonymous) @ MessageQueue.js:106
__guard @ MessageQueue.js:314 callFunctionReturnFlushedQueue @ MessageQueue.js:105 (anonymous) @ debuggerWorker.js:80 Show 5 more frames ExceptionsManager.js:82 Warning: RootErrorBoundary: Error boundaries should implement getDerivedStateFromError(). In that method, return a state update to display an error message or fallback UI.
尝试将SDK版本升级到34以上,这可能是因为react native safe area view最新版本 选中此项:
希望这有帮助 我希望这会对你有所帮助。我也遇到过同样的问题,但还是解决了。 公正程序:
npm install -g expo-cli
update expo
npm install -g expo-cli
update expo