requireNativeComponent: quot;RNSScreenStackHeaderConfigquot; was not found in the UIManager when running android app(运行Android应用时,在UIManager中找不到RequireNativeComponent:quot;RNSScreenStackHeaderConfigquot;)
问题描述
在Android上运行应用程序时,我收到此错误。它构建正确,但在异常情况下崩溃。我已经安装了REACTION-Native-Screens、@REACTION-Native/导航和https://reactnavigation.org/docs/getting-started/上列出的依赖项
com.facebook.react.common.JavascriptException:不变冲突:要求本机组件:在UIManager中找不到RNSScreenStackHeaderConfig&Quot;。
This error is located at:
in RNSScreenStackHeaderConfig
in Unknown
in RNSScreen
in N
in ForwardRef
in y
in E
in RNSScreenStack
in w
in RNCSafeAreaProvider
in Unknown
in v
in Unknown
in Unknown
in Unknown
in ForwardRef
in Unknown
in ForwardRef
in p
in c
in P
in RCTView
in View
in RCTView
in View
in h, stack:
它在iOS上构建和运行都很好,但当在Android上运行时,它会完全崩溃。我是不是忽略了什么?
这是我的包json。
{
"name": "<myprojectname>",
"version": "0.0.1",
"private": true,
"scripts": {
"android": "react-native run-android",
"ios": "react-native run-ios",
"start": "react-native start",
"test": "jest",
"lint": "eslint .",
"postinstall": "npx jetify",
"android:bundle:debug": "react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res/"
},
"dependencies": {
"@react-native-community/async-storage": "^1.8.1",
"@react-native-community/masked-view": "^0.1.11",
"@react-navigation/native": "^6.0.2",
"@react-navigation/native-stack": "^6.1.0",
"@react-navigation/stack": "^6.0.7",
"adbkit": "^2.11.1",
"moment": "^2.24.0",
"react": "16.9.0",
"react-native": "0.63.0",
"react-native-calendar-strip": "^1.4.1",
"react-native-calendars": "^1.264.0",
"react-native-firebase": "^5.6.0",
"react-native-gesture-handler": "^1.10.3",
"react-native-reanimated": "^2.2.0",
"react-native-safe-area-context": "^3.3.1",
"react-native-screens": "3.1.1",
"react-native-snap-carousel": "^3.8.4",
"react-native-vector-icons": "^6.6.0",
"react-navigation": "^4.4.4",
"react-navigation-stack": "^2.10.4",
"react-redux": "^7.2.0",
"redux": "^4.0.5"
},
"devDependencies": {
"@babel/core": "^7.15.0",
"babel-jest": "24.9.0",
"eslint": "^6.5.1",
"jest": "24.9.0",
"jetifier": "^1.6.5",
"metro-react-native-babel-preset": "^0.66.2",
"react-test-renderer": "16.9.0"
},
"jest": {
"preset": "react-native"
}
}
我真的不知道如何解决这个问题,我尝试过删除缓存、重新启动Metro、删除节点模块以及所有与&q;相关的&q;错误。甚至在我创建新项目并尝试安装和使用导航库时也会发生此错误。
这是我的入口点,示例复制自反应导航零食。
import * as React from 'react';
import { View, Text } from 'react-native';
import { NavigationContainer } from '@react-navigation/native';
import { createNativeStackNavigator } from '@react-navigation/native-stack';
import { enableScreens } from 'react-native-screens';
enableScreens(true);
function HomeScreen() {
return (
<View style={{ flex: 1, alignItems: 'center', justifyContent: 'center' }}>
<Text>Home Screen</Text>
</View>
);
}
function DetailsScreen() {
return (
<View style={{ flex: 1, alignItems: 'center', justifyContent: 'center' }}>
<Text>Details Screen</Text>
</View>
);
}
const Stack = createNativeStackNavigator();
function AppTest() {
return (
<NavigationContainer>
<Stack.Navigator
screenOptions={{
headerStyle: {
backgroundColor: '#f4511e',
},
headerTintColor: '#fff',
headerTitleStyle: {
fontWeight: 'bold',
},
}}
initialRouteName="Home">
<Stack.Screen options={{ title: 'My home' }} name="Home" component={HomeScreen} />
<Stack.Screen options={{ title: 'My home' }} name="Details" component={DetailsScreen} />
</Stack.Navigator>
</NavigationContainer>
);
}
export default AppTest;
有什么建议吗?
推荐答案
我在导航工作期间在iOS上遇到此问题。
我不确定到底是什么解决了这个问题。我重新安装了所有导航包,并运行npx pod-install
,清除了Metro缓存、构建数据、派生数据,错误消失了。
这篇关于运行Android应用时,在UIManager中找不到RequireNativeComponent:";RNSScreenStackHeaderConfig";的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:运行Android应用时,在UIManager中找不到RequireNativeComponent:";RNSScreenStackHeaderConfig";


- 想使用ViewPager,无法识别android.support.*? 2022-01-01
- Android viewpager检测滑动超出范围 2022-01-01
- 用 Swift 实现 UITextFieldDelegate 2022-01-01
- MalformedJsonException:在第1行第1列路径中使用JsonReader.setLenient(True)接受格式错误的JSON 2022-01-01
- 使用自定义动画时在 iOS9 上忽略 edgesForExtendedLayout 2022-01-01
- Android - 拆分 Drawable 2022-01-01
- android 4中的android RadioButton问题 2022-01-01
- Android - 我如何找出用户有多少未读电子邮件? 2022-01-01
- 在测试浓缩咖啡时,Android设备不会在屏幕上启动活动 2022-01-01
- 如何检查发送到 Android 应用程序的 Firebase 消息的传递状态? 2022-01-01