react-native - Screen navigate from stacknavigator not showing bottomtabnavigator
问题描述
i've got a bottomtabnavigator and a stacknavigator. When i navigate to a screen in stacknavigator, bottomtabnavigator is not showing in the screen. is there a way to show the bottomtabnavigator in screens from stacknavigator?
Below is my navigator codes:
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,
});
解决方案
This is taken from the react navigation documentation and it gives a good example of how to combine stackNavigators and 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 },
},
));
推荐阅读
- apache-spark - Spark结构化流作业中的java.io.FileNotFoundException
- reactjs - 反应给我错误:重新渲染太多。React 限制渲染次数以防止无限循环
- virtual-machine - 使用数据包生成执行 l2 转发时出现大量数据包丢失
- excel - VBA 代码无法通过“按钮”正常运行,但是当您通过 F8 逐步尝试时,它可以完美运行
- php - 如果 otp 验证,如何在注册页面上重定向,否则重定向到登录 Laravel?
- reactjs - “React.createContext 不是函数”仅在我使用情感/样式和 @testing-library/react 时
- python - 如何在同一错误上打破 While True 语句 3 次
- javascript - 如何在html中访问两个单词的对象
- html - Z-index 被忽略
- javascript - axios() 方法不适用于 POST 请求