Search code examples
typescriptreact-nativenavigationexpo

Execution flow in react native after navigation.navigate


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.