In my react-native project I have use DrawerNavigator from which I navigate to SwitchAccount page. In SwitchAccount page I have use Tabs from react-native-tabs. Below is code where I use
render() {
return (
<View style={[styles.container]}>
// Here _renderTab function return component based on selectedService
{this._renderTab(this.state.selectedService)}
<TabBarContainer
selectedService={this.state.selectedService}
onTabChange={this._switchService}
/>
</View>
);
}
When I click on tab then it change the state and then I get new component returned by _renderTab function. All works properly, but I want to change Header title based on the component returned by the _renderTab function. What should I do? Is there any way to change Header title from constructor? Below is my code for navigationOptions in SwitchAccount page. There I want to change title from constructor.
static navigationOptions = {
title:'Filter',
drawerLabel: 'Switch Account',
drawerIcon: ({ tintColor }) => (
<Icon
name='md-switch'
size={40}
color='black'
/>
),
};