2
votes

I'm having some problem with React Navigation.

I have a tab navigator with different tabs, one of them being a StackNavigator. Some times I wan't to navigate from Tab1 to some screen (let say A) in the StackNavigator I wan't some action to go back to Tab1 from the A screen in the StackNavigator.

I was able to find this action dispatching a. navigate action.

But I'm unable to have a "back" transition from A to Tab1

Many thanks for your help.

Regards, David

1

1 Answers

0
votes

Add the following in your "Screen A"

static navigationOptions = ({navigation}) => ({
    headerLeft: <HeaderBackButton onPress={() => navigation.goBack(null)}/>,
    backBehavior: 'initialRoute'
});

Don't forget to import HeaderBackButton:

import {HeaderBackButton} from 'react-navigation';