源代码是
this.props.navigation.dispatch(
NavigationActions.reset({
index: 0,
actions: [NavigationActions.navigate({ routeName: "Login" })]
})
);
react navigation的版本>2.0.0的时候需要用如下代码(reset方法由原来的NavigationActions 里面移到了StackActions,所以就会造成NavigationActions.reset is not a function导致路由无法跳转)
import { NavigationActions, StackActions} from 'react-navigation';
this.props.navigation.dispatch(
StackActions.reset({
index: 0,
actions: [NavigationActions.navigate({ routeName: "Detail" })]
})
);