React-native-splash-screen: how to hide statusbar ?

Created on 9 Oct 2017  路  26Comments  路  Source: crazycodeboy/react-native-splash-screen

I dont want to show status bar while showing splash screen in ios and android ! how to do it ?

Most helpful comment

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);
}

All 26 comments

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:
image
SplashScreen.java:
image
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:
image

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

__

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

Was this page helpful?
0 / 5 - 0 ratings