Maxim Romanyuk Maxim Romanyuk - 2 months ago 14
Android Question

StatusBar color in React Native

How can I change background color of

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 Source

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