How to hide header of createStackNavigator on React Native?

后端 未结 8 1332
耶瑟儿~
耶瑟儿~ 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:20

    update your code like this code

    const AppStackNavigator = createStackNavigator ({
        Home: {
            screen: HomePage, 
            navigationOptions: {
                header: null,
            },
        },
    })
    

    and if you dont want the header for all screens, then

    const AppStackNavigator = createStackNavigator ({
        Home: {
            screen: HomePage,
        },
    },
    {
        navigationOptions: {
            header: null,
        },
    })
    

    Note: This solution is for an old version of React Navigation.

提交回复
热议问题