It is common to want to configure the headers in a similar way on multiple screens.
class AppScreen extends React.Component {
static navigationOptions = {
header: null,
/* No more header config here! */
};
/* render function, etc */
}
/* other code... */
You can move the configuration to the stack navigator under Properties defaultNavigationOptions.
headerMode Specifies how the header should be rendered:
- float - Render a single header that stays at the top and animates as
screens are changed. This is a common pattern on iOS.
- screen - Each screen has a header attached to it and the header fades
in and out together with the screen. This is a common pattern on
Android.
- none - No header will be rendered.
const RootStack = createStackNavigator(
{
Apps: AppScreen,
Details: DetailsScreen,
},
{
initialRouteName: 'Apps',
headerMode: 'none'
/* if use header The header config from Apps is now here */
}
);