尝试我的主屏幕没有标签,并让我的应用程序的其余部分使用tabnavigator

时间:2018-04-23 16:43:57

标签: react-native

这是我的tabNav,我正在尝试加载HomeStackNav,但是当我这样做时,我的主屏幕组件下面有标签。

const TabNav = TabNavigator({
  HomeScreen: {screen: HomeStackNav},
  Dashboard: { screen: DashboardStackNav },
  Add: {screen: AddStackNav},
  Profile: { screen: ProfileStackNav },
}, {
  tabBarPosition: 'bottom',
  tabBarOptions: {
    activeTintColor: 'salmon',
    activeBackgroundColor: '#c0c1c4',
    inactiveTintColor: '#f4af55',
    inactiveBackgroundColor: 'white',
    labelOptions: {
      fontSize: 10,
      fontWeight: 'bold'
    },


  }
})

我尝试在此处和主屏幕组件中实现导航选项以隐藏选项卡,但没有成功。

const HomeStackNav = StackNavigator({
  HomeScreen: {
    screen: HomeScreen
  },
  Dashboard: {
    screen: Dashboard
  }
},
{
  initialRouteName: 'HomeScreen',
  navigationOptions: {
    header: null,
    tabBarVisible: false
  }
})

export default HomeStackNav;

1 个答案:

答案 0 :(得分:0)

尝试

navigationOptions: {
  tabBarVisible: false
}

作为TabNavigator

的一部分
HomeScreen: {screen: HomeStackNav}

所以

HomeScreen: {
  screen: HomeStackNav,
  navigationOptions: {
    tabBarVisible: false
  }
}

正如您所指的根导航。