前端之家收集整理的这篇文章主要介绍了
react-navigation的回调方法callback,
前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
screenA
const DEMO_TOKEN = await AsyncStorage.getItem('id_token');
if (DEMO_TOKEN === null) {
this.props.navigation.navigate('screenB',{
onGoBack: () => this.refresh(),});
return -3;
} else {
this.doSomething();
}
refresh() {
this.doSomething();
}
screenB
await AsyncStorage.setItem('id_token',myId);
this.props.navigation.state.params.onGoBack();
this.props.navigation.goBack();
原文链接:https://www.f2er.com/react/302301.html