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

[Android Question]: Set navigation bar background color?

Open luskin opened this issue 5 years ago • 6 comments

Hello.

We are simply trying to figure out how to change the background color of the soft keys/navigation bar at the bottom of some android phones (the virtual back button/home/app stack... etc).

I'm assuming it's an easy solution but we can't find documentation anywhere, thanks!

luskin avatar Nov 19 '19 02:11 luskin

We're using this package: https://github.com/thebylito/react-native-navigation-bar-color

loudy avatar Nov 26 '19 15:11 loudy

@loudy thanks for that but how are you setting the color on the launch screen?

luskin avatar Nov 26 '19 18:11 luskin

@loudy

Hello guys. Because of that I can't set my background color....

I have:

<resources>
    <!-- Base application theme. -->
    <style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
         ...
        <item name="android:navigationBarColor">@color/backgroundColor</item>
    </style>
</resources>

and it works. But while I see SPLASH SCREEN – react-native-splash-screen makes navigation bar BLACK.

How to set color for splash screen?

zmnv avatar May 07 '20 19:05 zmnv

Okay, I found it.

styles.xml:

<resources>
    <!-- Base application theme -->
    <style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
        <item name="android:windowBackground">@color/backgroundColor</item>
        <item name="android:statusBarColor">@color/backgroundColor</item>
        <item name="android:navigationBarColor">@color/backgroundColor</item>
        <item name="colorControlActivated">@color/blue</item>
    </style>
    <style name="SplashScreenTheme" parent="SplashScreen_SplashTheme">
        <item name="colorPrimaryDark">@color/backgroundColor</item>
        <item name="android:navigationBarColor">@color/backgroundColor</item>
    </style>
</resources>

Add R.style.SplashScreenTheme in MainActivity.java:

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

zmnv avatar May 07 '20 19:05 zmnv

That helps too. But anyone has an idea on how to change the background color of the system navigation bar on the splash screen in an expo-managed project?

BismarkCodes avatar Jan 24 '22 10:01 BismarkCodes

@loudy

Hello guys. Because of that I can't set my background color....

I have:

<resources>
    <!-- Base application theme. -->
    <style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
         ...
        <item name="android:navigationBarColor">@color/backgroundColor</item>
    </style>
</resources>

and it works. But while I see SPLASH SCREEN – react-native-splash-screen makes navigation bar BLACK.

How to set color for splash screen?

I found the solution by adding this to my app.json file.

"androidNavigationBar": { "barStyle": "dark-content", "backgroundColor": "#ffffff" },

NB: i'm using an expo-managed-project and I'm quite sure it should work in a bare react-native project too

BismarkCodes avatar Jan 24 '22 10:01 BismarkCodes