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

Question: how does this work in iOS #27

Open
StevePotter opened this issue Feb 14, 2017 · 5 comments
Open

Question: how does this work in iOS #27

StevePotter opened this issue Feb 14, 2017 · 5 comments

Comments

@StevePotter
Copy link
Contributor

@crazycodeboy could you please explain to me how the code in https://github.com/crazycodeboy/react-native-splash-screen/blob/master/ios/SplashScreen.m prevents the splash screen from hiding until hide() is called? I'm good with objC but don't understand the trick involved here. If you explain it and agree with me, I'd be happy to add a comment in the code for curious people like me.

@alinz
Copy link

alinz commented Feb 18, 2017

@StevePotter It is pretty simple, It has a forever loop which sleeps for 0.1 seconds. So once the React-Native lunches, then you have a chance to break that loop by calling hide method.

@StevePotter
Copy link
Contributor Author

@alinz I'm still confused. Does it occupy the main run loop, which causes UI events not to process, until hide is called?
\

@alinz
Copy link

alinz commented Feb 22, 2017

@StevePotter it does block. but because it sleeps for 0.1 seconds, it gives enough time to other tasks to be executed, But because you will break the loop in few seconds, I think it's ok! The elegant and more complex solution would be register for callback and let the os signal us when a task is done. But that requires a lot of code and to be honest with you, I would rather use the simple code than very deep complex code.

@QuantBull
Copy link

@alinz could hide statusbar on the ios platform when splash is shown? i am poor of Object-c. thanks.

@alinz
Copy link

alinz commented Nov 4, 2017

@iamweilee, There are multiple ways of doing this.
1: make the splash screen big enough to cover the status bar
2: hide status bar during app launch. I think you can do it inside xcode configuration. google it and you will find it.

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

3 participants