删除某些屏幕的顶部导航栏 [英] Remove top navigation bar for certain screens

查看:72
本文介绍了删除某些屏幕的顶部导航栏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法只删除特定屏幕的顶部导航栏?我正在使用反应导航.

Is there a way of removing the top navigation bar for specific screens only? I am using react-navigation.

我已经尝试了以下方法:

I already tried the following:

header: { visible: false }

但它只隐藏导航栏.导航栏的空间仍然无法使用.

but it only hides the navbar. The space of the navbar is still cannot be used.

提前致谢!

推荐答案

这是我如何使用 StackNavigator 的示例:

This is an example of how I did mine using StackNavigator:

const stackN = StackNavigator({
    Screen1 : {
      screen: Screen1,
      navigationOptions: {
        header: null,
      }
    },
    Home : {
      screen: HomeScreen,
      navigationOptions: ({navigation}) => ({
        title: 'Home',
        headerStyle: styles.headerStyle,
        headerTitle: <Text>Home</Text>,
        headerLeft : null,
        headerRight: null,
      })
    }, 
}, {headerMode: 'screen'})

所以每个屏幕都有自己的导航选项.可能有一种共享导航选项的方法,但我目前还没有研究.

So every screen have their own navigationOptions instead. There may be a way to share navigationOptions, but I haven't looked into it at the moment.

这篇关于删除某些屏幕的顶部导航栏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆