From 14139e41fd1124642dc4f5f5baca455189cdac7a Mon Sep 17 00:00:00 2001 From: Eric Vicenti Date: Thu, 19 Apr 2018 21:33:43 -0700 Subject: [PATCH] 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. --- packages/bottom-tabs/src/utils/createTabNavigator.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/bottom-tabs/src/utils/createTabNavigator.js b/packages/bottom-tabs/src/utils/createTabNavigator.js index 66f08bb6f2..107e6d5c53 100644 --- a/packages/bottom-tabs/src/utils/createTabNavigator.js +++ b/packages/bottom-tabs/src/utils/createTabNavigator.js @@ -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() {