Reputation: 11
I want to get some data from the localstorage on the device before the first screen starts rendering. I already have the functionality in place, but my question is as follows: Is there a way to execute code before React Native shows the first screen?
Right now I have added an extra screen that does these computations, when it is done, it will redirect to the "Home" page. However I would like to eliminate this launch screen altogether.
Right now, I have it implemented like this:
APP LAUNCH -> go to startup screen -> do some async computations -> once finished, go to home page.
The expected result would look something like this.
APP LAUNCH -> do some async computations -> once finished, go to home page.
Upvotes: 1
Views: 38
Reputation: 10848
If you are using the react-navigation so you can use the switch navigator
https://reactnavigation.org/docs/en/switch-navigator.html
https://snack.expo.io/@react-navigation/auth-flow-v3
Upvotes: 1