Execution flow in react native after navigation.navigate

Issue

Need suggestion and advice,

I am using the below 2 lines of code in react native expo component,

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);

my question:

Will "patchUser()" be called always, since this.props.navigation.navigate("App") has been executed before and it takes to another component ?

Solution

When navigating to "App", the screen with your code snippet above remains mounted, as described here. Therefore, your code should still execute.

Answered By – FredAstaire

Answer Checked By – Robin (AngularFixing Admin)

Leave a Reply

Your email address will not be published.