Fix tab action in v2

The action helpers may not be available at the navigator level, they will be there inside the screen.

This change dispatches a normal explicit action.
This commit is contained in:
Eric Vicenti
2018-04-19 21:33:43 -07:00
committed by satyajit.happy
parent 863bb2b14a
commit 14139e41fd

View File

@@ -6,6 +6,7 @@ import {
StackActions,
createNavigator,
createNavigationContainer,
NavigationActions,
} from 'react-navigation';
import SceneView from 'react-navigation/src/views/SceneView';
@@ -95,7 +96,9 @@ export default function createTabNavigator(TabView: React.ComponentType<*>) {
_handleIndexChange = index => {
const { navigation } = this.props;
navigation.navigate(navigation.state.routes[index].routeName);
navigation.dispatch(NavigationActions.navigate({
routeName: navigation.state.routes[index].routeName,
}));
};
render() {