react-native - 在 React Native Navigation 中更改“SingleScreenApp”的主屏幕
问题描述
我是 React Native 的新手,我想react-native-navigation
通过wix进行测试
我有一个带抽屉的 SingleScreenApp。见下文 :
Navigation.startSingleScreenApp({
screen: {
screen: 'example.HomeScreen',
title: 'Home',
navigatorStyle: {},
navigatorButtons: {}
},
drawer: {
// optional, add this if you want a side menu drawer in your app
left: {
screen: 'example.LefMenu',
passProps: {},
disableOpenGesture: false,
fixedWidth: 500
},
style: {
drawerShadow: true,
contentOverlayColor: 'rgba(0,0,0,0.25)',
leftDrawerWidth: 50,
rightDrawerWidth: 50
},
type: 'MMDrawer',
animationType: 'door',
disableOpenGesture: false
},
passProps: {},
animationType: 'slide-down'
});
为了具有类似菜单的行为,我想更改 SingleScreenApp 的主屏幕(通过单击按钮或其他交互)。
我坚持要更改/替换主屏幕,而不是推送或显示模式。
我应该用根屏幕不同的屏幕启动另一个 SingleScreenApp 吗?我应该使用“ resetTo ”方法吗?在性能方面什么是最好的?
非常感谢 !
解决方案
您确实想使用resetTo()。这将弹出所有当前推送的屏幕并用新的屏幕替换当前的根屏幕。
推荐阅读
- laravel - 在模型中需要时使用虚拟类进行测试
- css - Nginx pod 不提供 css 文件
- java - 在 NASA Worldwind 中实现 XYZ 平铺层
- django - 如何在 Django 中获取链接到另一个 HTML 模板的按钮?
- sql - 无效的 SQL 语句;在 SQL 语句中使用 IF EXISTS() 时出错,OLEDB MS ACCESS
- laravel - 如何使用 Laravel 更新选定下拉列表的值?
- python - 使用python将json数据加载到mysql中
- database - Oracle 数据库 RMAN 备份不恢复表或用户
- azure - 在 Azure Devops 中使用 GitVersion.yml 对 Nuget 包进行版本控制
- reactjs - 如何调整材料表的宽度?