1 | initial version |
To turn off the header in createDrawerNavigation for React Navigation within React Native, you can use the headerMode
option and set it to "none"
in the StackNavigator
that the drawer navigator is nested in. Here's an example:
import { createDrawerNavigator } from 'react-navigation-drawer';
import { createStackNavigator } from 'react-navigation-stack';
import HomeScreen from './screens/HomeScreen';
import ProfileScreen from './screens/ProfileScreen';
const AppNavigator = createStackNavigator(
{
Home: { screen: HomeScreen },
Profile: { screen: ProfileScreen },
},
{
headerMode: 'none',
}
);
const DrawerNavigator = createDrawerNavigator(
{
App: AppNavigator,
},
{
// drawer options
}
);
export default DrawerNavigator;
In this example, the AppNavigator
stack navigator has the headerMode
option set to "none"
. This removes the header from all screens in the stack navigator, which includes the screens that are displayed in the drawer navigator. Therefore, the header will also be removed from the drawer navigator screens.