【发布时间】:2021-04-15 07:46:05
【问题描述】:
我在我的 react-native 应用程序中使用 react-navigation 5。我有两个名为 A 和 B 的组件(例如)。从 A 组件我可以转到 B 组件,从 B 组件我可以转到 A 组件并可以刷新组件 A。但是当我按下 android-system 后退按钮时,我无法刷新以前的组件(A)。 /p>
示例代码:
Class A extend React.component{
componentdidmount = () => {
//some api call
}
render(){
return(
<Button onPress={this.props.navigation.push("B")}> Goto B Component</Button>
);
}
}
Class B extend React.component{
componentdidmount = () => {
//some api call
}
render(){
return(
<Button onPress={this.props.navigation.push("A")}> Goto A Component</Button>
);
}
}
当android-system后退按钮被按下时如何刷新之前的组件?谢谢
【问题讨论】:
-
嗨,stackoverflow.com/questions/44223727/…你也有同样的问题,祝你好运
-
使用 android 系统导航按钮(适用于每部 android 手机)我想更新以前的组件。提供的链接没有帮助。
标签: javascript reactjs react-native react-navigation