'Change navigation bar color

I know it is possible since API 21 to change the color of the navigation bar. I have looked at the documentation of React Native but I can not find a way to do this.

The only way I know is by creating a native module, but that does not seem like a good solution since I am using Expo.

Is there a built-in way to do this?



Solution 1:[1]

(For those using react-native-cli) Just add <item name="android:navigationBarColor">#0D0D0D</item> to your style in android/app/src/main/res/values/styles.xml like:

<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
    <item name="android:textColor">#000000</item>
    <item name="android:navigationBarColor">#0D0D0D</item> <!--  ADD THIS LINE TO YOUR styles.xml    -->
</style>

Solution 2:[2]

Below is another choice. It has recent commits.

react-native-navigation-bar-color

https://github.com/thebylito/react-native-navigation-bar-color

Solution 3:[3]

I created a package with color replacement and more.

react-native-system-navigation-bar

Install

yarn add react-native-system-navigation-bar

or

npm install react-native-system-navigation-bar

Links

https://www.npmjs.com/package/react-native-system-navigation-bar

https://github.com/kadiraydinli/react-native-system-navigation-bar

Solution 4:[4]

The other possible ways to change background color of Status Bar and Navigation Bar of Android Device is through StatusBar module and NativeModules

I already post my answer about NaigationBar of Android, you may check this

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 M_droid
Solution 2 Chenhua
Solution 3 kadiraydinli
Solution 4 Marvin