按照以下说明将react navigation升级到版本6后,https://reactnavigation.org/docs/upgrading-from-5.x/
我得到错误,ScreenStack只接受类型屏幕的孩子,有什么想法我可以修复它?
App.js:
export default () => {
const linking = {
prefixes: ['', ''],
config: {
screens: {
Register: 'register',
MyVehicle: 'MyVehicle',
},
},
};
return (
<Provider store={store}>
<AppRootStack />
</Provider>
);
};
应用程序根堆栈:
const AppRootStack = () => {
const { appState, appContext } = useContext(AppContext);
const { isLoading } = appState;
const { registerCallbackCompleted } = appContext;
if (isLoading === true) {
return <SplashScreen />;
}
return (
<RootStackNavigator
{...appState}
registerCallbackCompleted={registerCallbackCompleted}
/>
);
};
根堆栈导航器:
const RootStackNavigator = ({
}) => {
return (
<RootStack.Navigator initialRouteName={initialRouteName} mode="modal">
<RootStack.Screen
name={AppRoutes.Register.Name}
component={RegisterScreen}
options={{
title: AppRoutes.Register.Label,
headerShown: false,
animationEnabled: false,
}}
/>
</RootStack.Navigator>
);
};
1条答案
按热度按时间soat7uwm1#
对我来说,问题是
react-native-screens
是v2.x
,而不是v3.x
。