【发布时间】:2019-07-17 18:13:55
【问题描述】:
我正在设置一个带有堆栈导航的选项卡,当我尝试更改组件时出现意外行为。当我浏览选项卡时,我想打开堆栈导航的第一个组件。请查看此video,以便您了解我的意思。
我尝试传递道具“initialRouteName”但不起作用。这是我的代码:
const familyStackNavigator = createStackNavigator({
main: { screen: parentFamilyScreen },
resume: { screen: ResumeChildScreen }
},
{
mode: 'modal',
headerMode: 'none',
initialRouteName: 'main',
});
const parentAppStack = createMaterialBottomTabNavigator({
family: {
screen: familyStackNavigator,
navigationOptions: {
tabBarIcon: FirstTabIcon,
title: 'Familia'
}
},
bag: {
screen: parentBagScreen,
navigationOptions: {
tabBarIcon: SecondTabIcon,
title: 'Bolsillo'
}
},
{
initialRouteName: 'family',
activeColor: '#ED0F21',
inactiveColor: '#333333',
barStyle: { backgroundColor: 'white' },
labeled: true
})
【问题讨论】:
-
我相信这个答案会有所帮助:stackoverflow.com/a/48056079/3832047.
标签: html react-native react-navigation expo