mirror of
https://github.com/zhigang1992/react-navigation.git
synced 2026-03-06 22:39:41 +08:00
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:
committed by
satyajit.happy
parent
863bb2b14a
commit
14139e41fd
@@ -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() {
|
||||
|
||||
Reference in New Issue
Block a user