在采用了redux的项目中实现navigator的跳转。采用 react-native-router-flux +redux
在Router标签中Connect a to redux
triggeractions
Actions.BEFORE_ROUTE
Actions.AFTER_ROUTE
Actions.AFTER_POP
Actions.BEFORE_POP
Actions.AFTER_DISMISS
Actions.BEFORE_DISMISS
在reducer中state.set(‘currentRoute’,action.name)
update you component on focus
componentDidUpdate(prevProps) {
const prevRoute = prevProps.global.currentRoute
const currentRoute = this.props.global.currentRoute
if (currentRoute === 'payment' && prevRoute !== currentRoute) {
this.props.actions.doSomething()
}
}
last update 2016-08-31