-
Notifications
You must be signed in to change notification settings - Fork 82
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for a loading view rendered while the app loads #32
Conversation
full white screen showed right before the app renders
Here's my guess.. (sorry for the long response but we've stumbled into a deep architectural issue) One of the strengths of RN is the fact all JS<->native interaction is asynchronous by nature (since we have a JS shadow-"DOM" and React syncs it with native in batches in the background). The plus side of this is that the native UI thread is never stuck waiting for JS. When we change roots (from loading), right before changing roots the native side waits for the new root view to layout so the root switch is seamless (no flashes). This is not possible in our case because JS does the layout and it happens asynchronously. So the new root actually returns immediately with a white screen and asks the JS to layout. You switch roots and see this white screen. Then, a few milliseconds later the JS finishes layout and updates the native side and you finally see your UI. Hence, the flash. This issue also happens while we push new screens. The new screen is pushed as a white screen and layout happens during the transition animation - so this isn't silky smooth like in a pure native app. What can we do about it? Let's brainstorm..
|
This is an amazing response, thank you! I was able to get the But this obviously doesn't work for the other controllers, because they render multiple React views for the different parts (eg: navbar, tabs, etc). In this case I think we can rely on this notification from |
Ah, and any ideas on how to delay the change of roots? I can't seem to get the React root view to start rendering from |
@artald implemented there the root transition animation and he's using the snapshot. I'm assuming you're calling something like Let's try to introduce a small delay in his code. Maybe in this line? |
@pedro On the latest version (1.3.11) there's a fix for the black screen issue. I went for a simple implementation at the moment. You will not be able to customize the loading view at this point; instead, the splash image (or the storyboard) of your app will be automatically used and set as the If you can, please check and let me know if this solves the issue for you. Thanks. |
Hi, we wanted to update you that we are currently postponing the processing of pull requests. |
This replaces the black screen showed while the bundle is being loaded, but is still not 100% – a white screen flashes just before the app loads. Still trying to figure out why, let me know if you have any hints!