【发布时间】:2018-06-08 15:00:09
【问题描述】:
我想知道如何在 React Native 中触发导航操作(使用 react-navigation-redux-helpers)?
我厌倦了使用 NavigationActions.navigate({ routeName: 'App' }) 功能,但不行 :(
【问题讨论】:
标签: react-native redux navigation action
我想知道如何在 React Native 中触发导航操作(使用 react-navigation-redux-helpers)?
我厌倦了使用 NavigationActions.navigate({ routeName: 'App' }) 功能,但不行 :(
【问题讨论】:
标签: react-native redux navigation action
react-navigation 为您提供动作创建者,请参阅https://reactnavigation.org/docs/en/navigation-actions.html
import { NavigationActions } from 'react-navigation';
const navigateAction = NavigationActions.navigate({
routeName: 'Profile',
params: {},
action: NavigationActions.navigate({ routeName: 'SubProfileRoute' }),
});
this.props.navigation.dispatch(navigateAction);
【讨论】:
试试:
this.props.navigation.navigate('ScreenName')
【讨论】: