question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Status bar color not getting changed

See original GitHub issue

Am I doing something wrong? the statusbar color is not changing. It works on iphone but not on android. My code below

 <NavigationBar
                  title={{title:'Notifications', tintColor:'yellow'}}
                  tintColor="#ef5350"
                  statusBar={{style: 'light-content',tintColor:'#ef5350'}}
              />
screen shot 2017-04-18 at 10 18 08 pm

Issue Analytics

  • State:open
  • Created 6 years ago
  • Reactions:2
  • Comments:14

github_iconTop GitHub Comments

12reactions
abiralsubedicommented, Sep 24, 2018

If you are using Expo for React Native then here is the solution for setting Android Status Bar Color. First of all, In your app.json file add the code:

{
  "expo": {
    "sdkVersion": "Your given Version",
    "androidStatusBar": {
       "backgroundColor": "#4e2ba1" (Your desirable android Status Bar Color before the app loads)
    }
   }    
}

And then Go to Your Main Component or App.js, import ‘StatusBar’ from ‘react-native’. Then add Following Code in return:

return(
   <View style={{flex: 1}}>  (Do not forget to style flex as 1)
      <StatusBar translucent backgroundColor="rgba(0,0,0,0.2)"/>
      <Your Code>
   </View>
);

Here, we are setting the status bar color as Black but with 0.2 opacity. Your statusBar Color will be the same as your headerStyle background Color for Stack Navigator but a bit darker. For standard Android App, this is how the StatusBar color is set. Also, Make it translucent so that your app draws under the status Bar and looks nice.

It hope this works perfectly for you.

3reactions
jenskuhrjorgensencommented, Jun 15, 2017

Nice, thanks! 😄 However, I still think that styling the Android status bar through react-native-navbar should be possible.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Android Material: Status bar color won't change - Stack Overflow
While colouring the status bar is not supported <5.0, on 4.4 you can use a work around to achieve a darker colour: Make...
Read more >
How to change Status Bar text color in iOS - Sarunw
By default, the color of a status bar text will change according to the device appearance setting. For example, the text will be...
Read more >
How to Change the Color of Status Bar in an Android App?
Step 2: Navigate to res/values/colors.xml, and add a color that you want to change for the status bar. Step 3: In your MainActivity,...
Read more >
Change Android Activity Status Bar Color like a Pro - Mudit Sen
Explanation: Well, both method are fairly easy to understand. isColorDark checks if the color is Dark Enough. And setStatusBarColor accepts ...
Read more >
How to change the VSCode Status Bar Color
Change the Bottom Bar Color for a Theme ... If for some reason you tend to swap between multiple themes, it may make...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found