NavigatorIOS组件中隐藏导航栏在RN更新后不起作用 (React Native)

5

我最近将我的react native项目从 ~0.28升级到了最新版本 (0.43.2),但是我的导航栏不再隐藏了。

这是代码(它位于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>

将其添加在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
是的,在重新开始并重新添加我的组件后,它确实有效。 - Michael Campsall
1个回答

2

因此,在尝试通过剥离所有内容并将其简化为最基本形式来隔离问题后,我意识到问题不在任何我能找到的代码中。

我从头开始初始化了一个新项目,然后重新添加了所有组件,现在它可以正常工作了。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接