react-native-splash-screen icon indicating copy to clipboard operation
react-native-splash-screen copied to clipboard

how to hide statusbar ?

Open vishnuc opened this issue 6 years ago • 28 comments

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

vishnuc avatar Oct 09 '17 07:10 vishnuc

Show the splash screen in fullscreen mode by passing true as the first argument to .show()

lone-cloud avatar Oct 17 '17 02:10 lone-cloud

Did you mean as second ?

JustasPolis avatar Oct 19 '17 09:10 JustasPolis

Where should I pass first argument .show() in my app.js ?

vishnuc avatar Oct 19 '17 12:10 vishnuc

@hoboman313 android platform is ok, but how on ios? thanks.

southwhale avatar Nov 03 '17 12:11 southwhale

@vishnuc in android java code

southwhale avatar Nov 03 '17 12:11 southwhale

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 avatar Jul 02 '18 23:07 forster-thomas

forster-thomas, I tried your solution; not working. Is there any other ways?

TyLy83 avatar Jul 19 '18 01:07 TyLy83

@TyLy83 works for me, but only for android

SilencerWeb avatar Aug 17 '18 12:08 SilencerWeb

SplashScreen.m: image SplashScreen.java: image So, there is no param in IOS. I think we need object-c to hide statusbar.

jintangWang avatar Aug 23 '18 03:08 jintangWang

In IOS, add key UIStatusBarHidden in Info.plist like this: image

xiongyuk avatar Dec 25 '18 09:12 xiongyuk

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.

hezhii avatar Feb 26 '19 05:02 hezhii

@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

dougdesigner avatar Mar 01 '19 20:03 dougdesigner

It's work to me that can hide the StatusBar, But the image can't cover full screen.

mingxin-yang avatar Jun 20 '19 06:06 mingxin-yang

@mingxin-yang Me too. Did you find a solution?

liuyunzyj avatar Jan 09 '20 14:01 liuyunzyj

@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 avatar Jan 10 '20 02:01 mingxin-yang

@mingxin-yang That's how I configured it

liuyunzyj avatar Jan 10 '20 02:01 liuyunzyj

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 avatar Jan 10 '20 02:01 mingxin-yang

@mingxin-yang That's how I configured it

liuyunzyj avatar Jan 10 '20 02:01 liuyunzyj

Is there a problem with the picture? My picture is 960 x 1600 in drawable-xxhdpi

mingxin-yang avatar Jan 10 '20 02:01 mingxin-yang

@mingxin-yang no problem

liuyunzyj avatar Jan 10 '20 02:01 liuyunzyj

@mingxin-yang The startup diagram cannot cover the status bar. The status bar is white

liuyunzyj avatar Jan 10 '20 02:01 liuyunzyj

@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.

n0umankhan avatar Jun 02 '20 08:06 n0umankhan

Try: StatusBar.setHidden(true);

then turn it false when needed.

nativator avatar Jun 16 '20 17:06 nativator

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>_

Ajmal0197 avatar Jun 17 '20 08:06 Ajmal0197

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.

ravanspell avatar Oct 03 '20 05:10 ravanspell

@n0umankhan did you find any solutions? facing the same issue

scrapecoder avatar Oct 12 '20 11:10 scrapecoder

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.

zoobibackups avatar Sep 30 '21 07:09 zoobibackups

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! 🎉

betanyeli avatar Aug 28 '22 22:08 betanyeli