How to hide header of createStackNavigator on React Native?

后端 未结 8 1312
耶瑟儿~
耶瑟儿~ 2021-02-04 03:56

I want to hide header because I already have styled Toolbar in code:

import {createStackNavigator}
from \'react-navigation\'
const AppStackNavigator = createStac         


        
相关标签:
8条回答
  • 2021-02-04 04:27

    For hiding headers for specific screens or globally, you can do

    const StackNavigator = createStackNavigator({
        Home: {
            screen: HomePage,
            navigationOptions: {
                header: null // Will hide header for HomePage
            }
        }
    }, {
        navigationOptions: {
            header: null // Will hide header for all screens of current stack navigator,
            headerLeft: <HeaderLeft /> // Component to be displayed in left side of header (Generally it can be Hamburger)
            headerRight: <HeaderRight /> // Component to be displayed in right side of header
        }
    })
    

    Also note that, screen specific settings will override global settings. Hope, this helps.

    0 讨论(0)
  • 2021-02-04 04:34

    I used following code to hide the header.

       {
        navigationOptions: {
            header: null // Will hide header for all screens of current stack 
    
        }
    
    0 讨论(0)
提交回复
热议问题