StatusBar color in React Native

Maxim Romanyuk picture Maxim Romanyuk · May 11, 2017 · Viewed 13.6k times · Source

How can I change background color of StatusBar component from react-native, without editing Android specific files?

Docs says, that I can use backgroundColor property. But it fails. barStyle property, setBarStyle && setBackgroundColor static methods don`t work properly too.

Only hidden property works.

I`m using create-react-native-app, built with Expo.

Answer

Rick Liao picture Rick Liao · May 11, 2017

In Expo App, you need to edit app.json in your project root directory like this:

{
    "expo": {
        "sdkVersion": "16.0.0",
        "androidStatusBar": {
            "barStyle": "dark-content",
            "backgroundColor": "#0A48A5"
        }
    }
}

See Expo documentation: https://docs.expo.io/versions/v16.0.0/guides/configuration.html