在嵌套屏幕中添加后如何隐藏导航标题react-native

时间:2019-03-28 09:16:58

标签: react-native

我有一个主屏幕,其中有一个标题栏,该屏幕还包含2个选项卡,分别是Home和Settings,这两个选项卡都有自己的标题栏,它们是主屏幕中的一个按钮,当单击该按钮时,将调用Details屏幕我要隐藏此详细信息屏幕的主屏幕标题栏

MainScreen HeaderBar的代码

const TabScreen = createStackNavigator({
TabScreen: {
screen: RootStack,
navigationOptions: {
  headerTitle: 'Tabs'
},
},
});

标签代码

const RootStack = createMaterialTopTabNavigator(
{
Home: {
  screen: HomeRoot,
  navigationOptions : {
    tabBarLabel: 'Home',
    tabBarIcon:  <Image source={{uri: 
'https://png.icons8.com/Home/ultraviolet/50/3498db'}} style={{width:20, 
height: 20}}/>
  },
},
Settings: {
  screen: Settings,
  navigationOptions : {
    tabBarLabel: 'Setting',
    tabBarIcon:  <Image source={{uri: 
 'https://png.icons8.com/Home/ultraviolet/50/3498db'}} style= . 
 {{width:20, height: 20}}/>
  },     
},
},

“首页和详细信息代码”屏幕

const HomeRoot = createStackNavigator(
{
Home: {
  screen: Home,
},  
Details: {
  screen: Details,
}, 

},
{
initialRouteName: 'Home',
}
);

1 个答案:

答案 0 :(得分:0)

这是您要寻找的吗?

headerMode: 'none',