Nomura Nori
Nomura Nori

Reputation: 5167

How to prepare next screen before it appeared in react native navigation?

I am using the react-native-navigation package.

The problem is that on navigation from one to another screen, it shows briefly a white screen.

How can I have the next screen ready, so that when I change the screen it shows the pre rendered screen, not a white screen?

Thanks

Upvotes: 0

Views: 235

Answers (2)

Arun Sheoran
Arun Sheoran

Reputation: 1

Try not to fetch datas in componentWillMount(), do this in ComponentDidMount(). Let me knowif you were doing so.

Upvotes: 0

Shreyas Nisal
Shreyas Nisal

Reputation: 39

The screen should not be white when you navigate to it, unless you are trying to fetch data from a web-service or the AsyncStorage. The only method that can be used before a screen is loaded is the componentWillMount() method, which is generally used to prepare for the first render, in the sense that it is used to handle the configuration and the state. In any case, if you want to avoid the white screen when you are fetching data from the AsyncStorage, use a Splash Screen.

Upvotes: 1

Related Questions