[英]React Navigation upgrading 4.x to 5.x
const Stack = createStackNavigator(
{
Main: {
screen: Main,
},
AddList: {
screen: AddList,
},
},
{
headerMode: 'none',
navigationOptions: {
header: null,
},
},
);
I changed my code due to the new version for react navigation but I dont know how to implement the last part from the above code.由于反应导航的新版本,我更改了我的代码,但我不知道如何实现上述代码的最后一部分。 Im not sure if i use Stack.Screen to implement headerMode and navigationoptions or Stack.navigator
我不确定我是使用 Stack.Screen 来实现 headerMode 和 navigationoptions 还是 Stack.navigator
const Stack = createStackNavigator();
function RootStack() {
return (
<Stack.Screen
headerMode: 'none'
options={{header: null}}
>
<Stack.Screen
name="AddList"
component={AddList}
/>
<Stack.Screen
name="Profile"
component={Profile}
/>
</Stack.Screen>
);
}
headerMode and navigationoptions are not working anymore. headerMode 和 navigationoptions 不再起作用。
Now you have to use the props screenOptions
of the Stack.Navigator (which is surrounding Stack.Screen)现在您必须使用 Stack.Navigator 的道具
screenOptions
(围绕 Stack.Screen)
const Stack = createStackNavigator();
function RootStack() {
return (
<Stack.Navigator
screenOptions={{ headerShown: false }}
>
<Stack.Screen
name="AddList"
component={AddList}
/>
<Stack.Screen
name="Profile"
component={Profile}
/>
</Stack.Navigator>
);
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.