Skip to content
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

How to use callback from getGlobe to using loading screen #64

Open
mattography opened this issue Apr 21, 2021 · 1 comment
Open

How to use callback from getGlobe to using loading screen #64

mattography opened this issue Apr 21, 2021 · 1 comment

Comments

@mattography
Copy link

I'm trying to show a loading screen before the globe is fully initialized (it seems to currently show a randomized color in place of the globe), before the texture is loaded. I've tried using getGlobe={} to find a boolean I can use when the globe is fully ready, but this keeps the globe itself from rendering.

@mattography
Copy link
Author

mattography commented May 4, 2021

Solution is to use
<ReactGlobe onGlobeTextureLoaded={() => setGlobeLoaded(true)} onGlobeCloudsTextureLoaded={() => setCloudsLoaded(true)} />

And then use the state values to show a loading screen:

{!(cloudsLoaded && globeLoaded) && ( <div> <h1>Loading...</h1> </div> )}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant