pageOne
this.props.navigation.navigate('pageTwo',
{
callback: ((data) => { //回调函数
this.setState({
data: data
})
})
})
pageTwo
if (this.props.navigation.state.params.callback) {
this.props.navigation.state.params.callback(data)
}
//下面操作是返回
const backAction = NavigationActions.back();
this.props.navigation.dispatch(backAction);
当然需要相关的模块引入import { NavigationActions } from 'react-navigation';
https://blog.csdn.net/weixin_41534645/article/details/80149803
网友评论