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

Status Bar Background

Open archieherbias opened this issue 7 years ago • 14 comments

Is it possible to change the status bar color of the splashscreen?

archieherbias avatar Sep 15 '17 08:09 archieherbias

The easiest way that I found is to monkey patch your status bar color like <item name="colorPrimaryDark">#400101</item> into res/values/styles.xml's SplashScreen_SplashTheme from this library.

lone-cloud avatar Sep 27 '17 03:09 lone-cloud

status bar is black and the icons are also black this issue still persists

Noor0 avatar Jun 28 '18 12:06 Noor0

this version works right: "react-native-splash-screen": "^3.0.6"

also add <color name="primary_dark">#2b8ce5</color> this in colors.xml

AE0011 avatar Jul 24 '18 14:07 AE0011

It works as long as you also change your show method to include your custom style.

From the README:

If you want to customize the color of the status bar when the splash screen is displayed:

Create android/app/src/main/res/values/colors.xml and add

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <color name="status_bar_color"><!-- Colour of your status bar here --></color>
</resources>

Create a style definition for this in android/app/src/main/res/values/styles.xml:

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <style name="SplashScreenTheme" parent="SplashScreen_SplashTheme">
        <item name="colorPrimaryDark">@color/status_bar_color</item>
    </style>
</resources>

Change your show method to include your custom style:

SplashScreen.show(this, R.style.SplashScreenTheme);

chico avatar Aug 20 '18 15:08 chico

It works as long as you also change your show method to include your custom style.

From the README:

If you want to customize the color of the status bar when the splash screen is displayed:

Create android/app/src/main/res/values/colors.xml and add

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <color name="status_bar_color"><!-- Colour of your status bar here --></color>
</resources>

Create a style definition for this in android/app/src/main/res/values/styles.xml:

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <style name="SplashScreenTheme" parent="SplashScreen_SplashTheme">
        <item name="colorPrimaryDark">@color/status_bar_color</item>
    </style>
</resources>

Change your show method to include your custom style:

SplashScreen.show(this, R.style.SplashScreenTheme);

Hey @chico I got this error if I change my show method like this

image

rizkiandrianto avatar Jan 08 '19 09:01 rizkiandrianto

@rizkiandrianto the symbol after the R.style.<THEME_NAME> should match the name of the theme inside styles.xml

in my case the name of the theme was SplashTheme

<resources>
    <!-- Base application theme. -->
    <style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
        <!-- Customize your theme here. -->
    </style>

    <style name="SplashTheme" parent="Theme.AppCompat.Light.NoActionBar">
	<item name="android:windowBackground">@drawable/background_splash</item>
	<item name="android:statusBarColor">@color/splash_background</item>
    </style>
</resources>

so I'm passing R.style.SplashTheme to my SplashScreen.show()

SplashScreen.show(this, R.style.SplashTheme);

Noor0 avatar Jan 10 '19 11:01 Noor0

For some reason addid SplashScreen.show(this, R.style.SplashTheme); causes white screen flash between splash screen and app mounting, any one facing the same issue or know a fix?

OmarBasem avatar Jul 26 '19 13:07 OmarBasem

@ramon90 i fixed the white screen with

    <style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
        <item name="android:statusBarColor">@color/bg</item>
        <item name="android:windowIsTranslucent">true</item> <--------- add this
    </style>

kg-currenxie avatar Aug 07 '19 02:08 kg-currenxie

@RAMON90 i fixed the white screen with

    <style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
        <item name="android:statusBarColor">@color/bg</item>
        <item name="android:windowIsTranslucent">true</item> <--------- add this
    </style>

This didn't resolve white screen flash between splash screen and app mounting

parth-koshta avatar Oct 10 '20 08:10 parth-koshta

For some reason addid SplashScreen.show(this, R.style.SplashTheme); causes white screen flash between splash screen and app mounting, any one facing the same issue or know a fix?

were you able to solve this?

parth-koshta avatar Oct 10 '20 08:10 parth-koshta

If none of this methods allow you to trick conversion error, add true as a third arg of show method like this SplashScreen.show(this, R.style.SplashTheme, true); Change it to false to disable fullscreen

Revolt9k avatar Jun 02 '22 09:06 Revolt9k

I fixed this problem I just add true SplashScreen.show(this, true);

JJalit avatar Dec 10 '22 14:12 JJalit

Something might have changed in last versions of android.

This gives me an error telling that the second argument should be a boolean: SplashScreen.show(this, R.style.SplashTheme);

And this makes the statusBar and the navigationBar with the background color: SplashScreen.show(this, true);

moooss avatar May 05 '23 13:05 moooss

Thanks for the solution, just a little change what I did is to add a third argument true (boolean value) in SplashScreen.show method

Malik-Usman17 avatar Jun 13 '23 06:06 Malik-Usman17