react-native - Stacknavigator 中 Tabnavigator 的导航
问题描述
我正在开发一个 react native 项目,我同时使用 Stack navigator 和 Tab navigator。应用程序的主要流程应该在堆栈导航中。我在其中一个屏幕上添加了一个按钮,该按钮在标签导航中,但导航没有发生!我怎样才能得到帮助,请帮助我示例代码:
const Nav=createStackNavigator({
Splash: Splash,
Login: Login,
Tab:tab
})
const Tab=createBottomNavigator({
Home:Home,
Profile:Profile // i added button in this screen want to navigate to Login
})
解决方案
我可以通过为我想要在标签导航中的屏幕创建另一个堆栈来解决导航问题,如下所示并且能够实现导航。
//New Stack
const Stack=createStackNavigator({
Profile:Profile,
Login:Login
})
//Old Stacks
const Tab=createBottomTabNavigator({
Home:Home,
Profile:Profile
})
const Nav=createStackNavigator({
Splash:Splash,
Login:Login,
Tab:Tab
})
推荐阅读
- javascript - 有没有办法将 JSON 对象/服务器数据传递给从 webpack 生成的主 JS 模块?
- c# - 包含字典的 C# 复杂对象
XML反序列化问题 - c# - 使用 LDAP 和 C# 拒绝访问
- numeric - 仅在 qlikview 中获取数字值
- python - Python,Tensorflow ValueError:没有为任何变量提供梯度
- python - 如何在 Python 中使用 ssh-keygen ed25519 密钥进行加密?
- python - 导出 CSV 显示 ImportError: cannot import name 'CompressionOptions' from 'pandas._typing'
- postgresql - 在 Manjaro 上哪里可以找到 postgresql.log
- html - 标记html宽度溢出-y和fancybox滚动
- r - 用点分割线串并在 R 中分配新的段 ID