I have to navigate to a particular tab when pressed from drawer items. I searched around a lot but couldnt find anything relating to my problem
i tried to follow this link of navigation actions but couldnt find out how to implement it Navigate to specific tab from Drawer Navigator.
const TabNavigator = createMaterialTopTabNavigator(
{
Upcoming: { screen: UpcomingScreen },
Accepted: { screen: AcceptedScreen },
Ongoing: { screen: OngoingScreen },
Completed: { screen: CompletedScreen },
},
);
const Screen1_StackNavigator = createStackNavigator({
First: {
screen: TabNavigator,
},
});
const DrawerNavigatorExample = createDrawerNavigator({
Screen1: {
//Title
screen: Screen1_StackNavigator,
navigationOptions: {
drawerLabel: 'Upcoming Trips',
labelStyle: {
fontFamily: Fonts.LatoLight,
fontWeight: '200',
},
drawerIcon: () => (
// <Icon name="align-center" size={20} color="#365888" />
<Image style={{height: 20, width: 21}} source={require('./images/calendar.png')} />
)
},
},
Screen2: {
//Title
screen: Screen2_StackNavigator,
navigationOptions: {
drawerLabel: () => null,
},
},
Screen3: {
//Title
screen: Screen1_StackNavigator,
navigationOptions: {
drawerLabel: 'Accepted Trips',
labelStyle: {
fontFamily: Fonts.LatoLight,
fontWeight: '200',
},
drawerIcon: () => (
// <Icon name="align-center" size={20} color="#365888" />
<Image style={{height: 22, width: 22}} source={require('./images/sticker.png')} />
)
},
},
Screen4: {
//Title
screen: Screen1_StackNavigator,
navigationOptions: {
drawerLabel: 'Ongoing Trips',
labelStyle: {
fontFamily: Fonts.LatoLight,
fontWeight: 'normal'
},
drawerIcon: () => (
// <Icon name="align-center" size={20} color="#365888" />
<Image style={{height: 22, width: 22}} source={require('./images/navigator.png')} />
)
},
},
Screen5: {
//Title
screen: Screen1_StackNavigator,
navigationOptions: {
drawerLabel: 'Completed Trips',
labelStyle: {
fontFamily: Fonts.LatoLight,
fontWeight: 'normal'
},
drawerIcon: () => (
// <Icon name="align-center" size={20} color="#365888" />
<Image style={{height: 24, width: 20}} source={require('./images/checklist.png')} />
)
},
},
})
When i press on the " Screen3 " on the drawer menu it should navigate to " Accepted " screen in tab navigator. When i press " Screen4 " on the drawer menu it should navigate to " Ongoing " screen in the tab navigator. When i press " Screen5 " on drawer menu it should navigate to " Completed " screen in the tab navigator. Is there any way to achieve it ? Thanks