How to hide header of createStackNavigator on React Native?
To disable headers for all views in a createStackNavigator
, you can use headerMode
option.
const AppStackNavigator = createStackNavigator({
Home: HomePage,
Friend: AddFriend,
Bill: AddBill,
},
{
headerMode: 'none',
})
Reference: StackNavigatorConfig - createStackNavigator - React Navigation
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.