Skip to content

Commit

Permalink
Fix tab action in v2
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
ericvicenti authored and satya164 committed Aug 18, 2019
1 parent 863bb2b commit 14139e4
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/bottom-tabs/src/utils/createTabNavigator.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
StackActions,
createNavigator,
createNavigationContainer,
NavigationActions,
} from 'react-navigation';
import SceneView from 'react-navigation/src/views/SceneView';

Expand Down Expand Up @@ -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() {
Expand Down

0 comments on commit 14139e4

Please sign in to comment.