I am trying to remove the header (see image) on sibling navigators.
I have a stackNavigator like so:
const navigator = createStackNavigator({
'route': RouteComponent,
'sibling1': Sibling1Navigator,
'sibling2': Sibling2Navigator,
},
{
...defaultNavigationOptions,
// @ts-ignore
headerLayoutPreset: 'center',
headerMode: 'screen',
})
sibling1Navigator looks like this:
const Sibling1Navigator = createStackNavigator(
{
'route1': Route1Component,
'route1': Route2Component,
'route3': Route3Component,
},
{
transitionConfig: HorizontalSlideTransitionConfig,
navigationOptions: ({ navigation: { goBack, state, navigate } }) => {
return {
headerTransparent: true,
headerStyle: {
backgroundColor: '#FFF0',
},
headerLeft: (
// tslint:disable-next-line
<Button />
),
}
},
},
)
I use a header on route
to show a title but on routes route1
or route2
I don't want the back to page (like image).
I am using react-navigation: ^2.17.0
I have seen lots of examples of how to do this. the simplest would be to add the config to each page. I have had a look at all the answers on this question similar question but I was hoping there was something I could do with the stackNavigators. Is there another way of doing it or does it have to be done inside of the component?