我有一个bottomtabnavigator和一个stacknavigator。当我导航到stacknavigator中的屏幕时,屏幕中未显示bottomtabnavigator。有没有办法在stacknavigator的屏幕上显示bottomtabnavigator?
以下是我的导航代码:
const TabNavigator = createBottomTabNavigator(
MainTabNavigator
);
const stackScreens = createStackNavigator({
profile: {screen: ProfileScreen},
loginform: {screen: LoginFormScreen},
merchant: {screen : merchantScreen},
registerform: {screen: RegisterFormScreen},
offer:{screen: offerScreen},
});
const navigator = createStackNavigator({
TabNavigator,
stackScreens,
});
答案 0 :(得分:0)
这取自the react navigation documentation,它为如何组合stackNavigators和tabNavigators提供了一个很好的例子
see the full snack for a working example
const HomeStack = createStackNavigator({
Home: { screen: HomeScreen },
Details: { screen: DetailsScreen },
});
const SettingsStack = createStackNavigator({
Settings: { screen: SettingsScreen },
Details: { screen: DetailsScreen },
});
export default createAppContainer(createBottomTabNavigator(
{
Home: { screen: HomeStack },
Settings: { screen: SettingsStack },
},
));