在RN更新后NavigatorIOS组件(react-native)中隐藏导航栏
问题描述:
我最近将反应原生项目从〜0.28升级到最新版本(0.43.2),并且出于某种原因,我的导航栏没有更长的隐藏对我来说。在RN更新后NavigatorIOS组件(react-native)中隐藏导航栏
下面是代码(这是坐在TabBarIOS分量):
<TabBarIOS.Item
selected={this.state.selectedTab === 'home'}
title='Home'
icon={require ('./Icons/IconImages/HomeTabIcon.png')}
onPress={
() => this._tabPressed('home')
}>
<NavigatorIOS
style={styles.container}
ref="nav"
interactivePopGestureEnabled={false}
initialRoute={{
title: 'Home',
component: HomeNavigationController,
navigationBarHidden: true, //this does nothing now
showTabBar: false, //this is to hide the bottom tabBar
passProps: {
...
},
}}/>
</TabBarIOS.Item>
增加IT以外initialRoute
也不起作用:
<NavigatorIOS
style={styles.container}
ref="nav"
interactivePopGestureEnabled={false}
initialRoute={{
title: 'Home',
component: HomeNavigationController,
showTabBar: false,
passProps: {...},
}}
navigationBarHidden={true} // does not work
/>
答
所以,试图通过隔离问题后剥离所有东西并将其减少到最基本的形式,我意识到问题不在我能找到的任何代码中。
我从零开始初始化一个新项目,然后重新添加所有组件,现在它工作得很好。
你的代码,第二个版本,正在为我工作(0.43)。什么是styles.container? – Ludovic
是的,它开始并重新添加我的组件后确实工作。 –