react-native - 如何使用wix反应本机导航隐藏ios上的后退按钮
问题描述
我整个早上都被这个问题困住了。我已经阅读了多个 GitHub 问题和 StackOverflow 帖子,但没有任何效果。
我想删除下图左上角的蓝色后退按钮。 我注意到我无法完全自定义顶部栏。我无法为后退按钮等添加标题(此提示可能表明出了什么问题)。
导航.setRoot
Navigation.events().registerAppLaunchedListener(() => {
Reactotron.log('5');
Navigation.setRoot({
root: {
stack: {
children: [{
component: {
id: STARTING_SCREEN,
name: STARTING_SCREEN
}
}],
}
},
layout: {
orientation: 'portrait',
},
}).then(()=>Reactotron.log('7'));
导航.push
SplashScreen(根屏幕)-> AccessScreen(下一个屏幕)。
Navigation.push(this.props.componentId, {
component: {
name: screen
},
options: {
topBar: {
backButton: {
visible: false,
}
}
}
就好像我在错误的地方指定了 backButton 选项。
解决方案
使用它,但仅适用于 ios
Navigation.setDefaultOptions({
topBar: {
backButton: {
visible: false
}
},
})
或者你可以自定义 topBar
Navigation.push(this.props.componentId, {
component: {
name: screen
},
options: {
topBar: {
backButton: {
background: YourComponent
}
}
}
推荐阅读
- python-3.x - 如何配置 Cookiecutter Django 以使用 Gmail SMTP
- sql - SQL sum 两个表之间不存在项
- sed - grep 与 sed 重新加入文件的其余部分
- spring-boot - 使用 JAX-RS 和 Spring 为集成测试创建 Spring Boot 应用程序上下文失败
- python - 如果我通过该类的实例设置类属性会发生什么?
- php - 如何计算和求和数组每一列中的出现次数?
- angular - Angular 7 - 更改路由内单个组件的基本 URL
- java - 由于国家/地区限制,Firebase 身份验证的登录/注册屏幕崩溃
- apache-spark - 在 dataproc / gcp 中顺序执行多个 Spark 作业
- payment-gateway - AesCryptUtil 无法解析为 ccAvenue 支付网关中的类型