I have nested navigator in my app. I would like my header bar to be set on the root of the navigaton, so there will be a mutual header bar to all screens in my application.
my index.js is:
const StackOpportunityNavigator = createStackNavigator(
{
MainOpportunity: OpportunityScreen,
ClientScreen: ClientScreen,
BusinessMapLocation: BusinessMapLocation,
LoginScreen: LoginScreen
},
{
initialRouteName: 'MainOpportunity',
headerMode: 'none',
transitionConfig: () => fromLeft(600),
}
);
const DrawerNavigationOptions = createDrawerNavigator(
{
OpportunityStack: { screen: StackOpportunityNavigator },
History: HistoryScreen,
MyChances: MyChancesScreen,
Info: InfoScreen
},
{
contentComponent: (props) => <SideBar {...props} />,
drawerPosition: 'right',
transitionConfig: () => fromLeft(600),
}
);
const LoginNavigator = createStackNavigator(
{
LoadingScreen: LoadingScreen,
LoginScreen: LoginScreen,
DrawerNavigator: DrawerNavigationOptions
},
{
transitionConfig: () => fromLeft(600),
headerMode: 'screen',
navigationOptions: {
headerStyle: {
backgroundColor: Colors.primary
},
headerTintColor: '#fff',
headerTitleStyle: {
fontWeight: 'normal',
fontSize: 18
}
}
}
);
export default LoginNavigator;
In every screen in my application i have this code:
static navigationOptions = {
header: <HeaderBar title={'currentScreenTitle'} />
};
However it works from 'LoginScreen' screen and all the others from 'LoginNavigator', but not from any other screen like 'History'.
How can i still control the navigation options from other screen like 'History' and set the title, if my navigation header bar is in the most root navigator?
Hope you understand my question. Really hope to for your answers as fast as possible. Thanks guys!