react-native-splash-screen
react-native-splash-screen copied to clipboard
how to hide statusbar ?
I dont want to show status bar while showing splash screen in ios and android ! how to do it ?
Show the splash screen in fullscreen mode by passing true as the first argument to .show()
Did you mean as second ?
Where should I pass first argument .show() in my app.js ?
@hoboman313 android platform is ok, but how on ios? thanks.
@vishnuc in android java code
On MainActivity.java, just like that:
@Override
protected void onCreate(Bundle savedInstanceState) {
SplashScreen.show(this, true); // <- second parameter is true, to hide StatusBar
super.onCreate(savedInstanceState);
}
forster-thomas, I tried your solution; not working. Is there any other ways?
@TyLy83 works for me, but only for android
SplashScreen.m:
SplashScreen.java:
So, there is no param in IOS. I think we need object-c
to hide statusbar.
In IOS, add key UIStatusBarHidden in Info.plist like this:
In iOS, set yes
to "Status bar is initially hidden". And call StatusBar.setHidden(false)
to show the status bar after splash screen is hidden.
@forster-thomas On MainApplication.java I am getting this error.
error: cannot find symbol SplashScreen.show(this, true); // <- second parameter is true, to hide StatusBar ^ symbol: variable SplashScreen
Can you share more of your file structure, in case it differs from the package read me MainApplication.java example for manual installation. https://github.com/crazycodeboy/react-native-splash-screen#second-stepplugin-installation
It's work to me that can hide the StatusBar, But the image can't cover full screen.
@mingxin-yang Me too. Did you find a solution?
@liuyunzyj Sorry, I forget how to fix this problem before. this is my code :
launch_screen.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop"
android:src="@drawable/launch_screen" />
</RelativeLayout>
@mingxin-yang That's how I configured it
style.xml
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<!-- Customize your theme here. -->
<!--<item name="android:windowIsTranslucent">true</item>-->
</style>
</resources>
@mingxin-yang That's how I configured it
Is there a problem with the picture? My picture is 960 x 1600 in drawable-xxhdpi
@mingxin-yang no problem
@mingxin-yang The startup diagram cannot cover the status bar. The status bar is white
@liuyunzyj did you solved this problem in my case status bar is hidden but black space is still there i guess i have a similar problem as you had.
Try: StatusBar.setHidden(true);
then turn it false when needed.
IN mainactivity.js @Override protected void onCreate(Bundle savedInstanceState) { SplashScreen.show(this, true); // <- second parameter is true, to hide StatusBar super.onCreate(savedInstanceState); }
IN res/values/styles.xml
_<style name="SplashTheme" parent="Theme.AppCompat.Light.NoActionBar">
<item name="android:windowBackground">@drawable/background_splash</item>
<item name="android:windowTranslucentNavigation">false</item>
<item name="android:windowNoTitle">true</item>
<item name="android:windowActionBar">true</item>
<item name="android:windowFullscreen">true</item>
<item name="android:windowContentOverlay">@null</item>
<item name="android:windowDrawsSystemBarBackgrounds">false</item>
</style>_
On MainActivity.java, just like that:
@Override protected void onCreate(Bundle savedInstanceState) { SplashScreen.show(this, true); // <- second parameter is true, to hide StatusBar super.onCreate(savedInstanceState); }
This works thank you!, p.s you need to rebuild app again to see result.
@n0umankhan did you find any solutions? facing the same issue
On MainActivity.java, just like that:
@Override protected void onCreate(Bundle savedInstanceState) { SplashScreen.show(this, true); // <- second parameter is true, to hide StatusBar super.onCreate(savedInstanceState); }
This works thank you!, p.s you need to rebuild app again to see result.
style.xml
<resources> <!-- Base application theme. --> <style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar"> <!-- Customize your theme here. --> <!--<item name="android:windowIsTranslucent">true</item>--> </style> </resources>
I want to have traslusent statusbar with transparent color or no statusbar, your answer adds a solid color with no content, it is not fullscreen activity.
IN mainactivity.js @OverRide protected void onCreate(Bundle savedInstanceState) { SplashScreen.show(this, true); // <- second parameter is true, to hide StatusBar super.onCreate(savedInstanceState); }
IN res/values/styles.xml
_<style name="SplashTheme" parent="Theme.AppCompat.Light.NoActionBar"> <item name="android:windowBackground">@drawable/background_splash</item> <item name="android:windowTranslucentNavigation">false</item> <item name="android:windowNoTitle">true</item> <item name="android:windowActionBar">true</item> <item name="android:windowFullscreen">true</item> <item name="android:windowContentOverlay">@null</item> <item name="android:windowDrawsSystemBarBackgrounds">false</item> </style>_
Omg Thanks, it worked for me! 🎉