navigation.navigate 后 React Native 中的执行流程
Execution flow in react native after navigation.navigate
需要建议和建议,
我在 React Native expo 组件中使用以下两行代码,
this.props.navigation.navigate("App");
patchUser(this.state.dataSource.userInfo.username, this.state.dataSource.userInfo.firstName,this.state.dataSource.userInfo.lastName, this.state.dataSource.lastLoginTime);
我的问题:
“patchUser()”是否会一直被调用,因为 this.props.navigation.navigate("App") 之前已经执行过并且需要另一个组件?
当导航到“应用程序”时,带有上面代码片段的屏幕保持挂载状态,如 here 所述。因此,您的代码仍应执行。
需要建议和建议,
我在 React Native expo 组件中使用以下两行代码,
this.props.navigation.navigate("App");
patchUser(this.state.dataSource.userInfo.username, this.state.dataSource.userInfo.firstName,this.state.dataSource.userInfo.lastName, this.state.dataSource.lastLoginTime);
我的问题:
“patchUser()”是否会一直被调用,因为 this.props.navigation.navigate("App") 之前已经执行过并且需要另一个组件?
当导航到“应用程序”时,带有上面代码片段的屏幕保持挂载状态,如 here 所述。因此,您的代码仍应执行。