gpt4 book ai didi

javascript - requireNativeComponent : "RNSScreenStackHeaderConfig" was not found in the UIManager when running android app

转载 作者:行者123 更新时间:2023-12-04 23:37:24 28 4
gpt4 key购买 nike

在android上运行应用程序时出现此错误。它构建正确,但异常崩溃。我已经安装了 React-native-screens、@React-native/navigation 和 https://reactnavigation.org/docs/getting-started/ 上列出的依赖项
com.facebook.react.common.JavascriptException:不变违规:requireNativeComponent:在 UIManager 中找不到“RNSScreenStackHeaderConfig”。

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、删除节点模块和所有“相关”错误。当我创建一个新项目并尝试安装和使用导航库时,甚至会发生此错误。
这是我的入口点,从 React-navigation 小吃复制的示例。
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 ,清理地铁缓存,构建数据,派生数据和错误消失了。

关于javascript - requireNativeComponent : "RNSScreenStackHeaderConfig" was not found in the UIManager when running android app,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/69043806/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com