I have a Navigation Controller, where I am coloring my navigation bar with some color, and I want the status bar (which shows the carrier, wifi symbol, etc) to use the same color.
So in Info.plist
, I have set View controller-based status bar appearance equal
to NO
. And in the Target > Deployment Info
I set the Status Bar Style > Light
:
I can see that the status bar is now indeed using the "light" style as the text is light/white. But the status bar background is still not the same as the Navigation bar as seen below. How can I correct this?
Now, you can change the statusbar color after turning on the settings. Just tap on the color palate and select a color according to your choice. This is also possible to change the status bar icon color. For that, just select Statusbar icon color and select a color. That’s it. In this way, you can change the status bar color of your Android device.
:' ( According to the react-native Statusbar docs it is possible to change the style (and background color) of the status bar: But in react-native-navbar it seems that only the iOS status bar is being styled:
If you are using Expo for React Native then here is the solution for setting Android Status Bar Color. And then Go to Your Main Component or App.js, import 'StatusBar' from 'react-native'. Then add Following Code in return: Here, we are setting the status bar color as Black but with 0.2 opacity.
That is Status Bar, where you can look at network status, battery level, time and sometimes date too. Nonetheless, the navigation bar or soft menu bar isn’t positioned on all Android devices. Although, you can get that on most of the Android devices but sometimes, that could create some issues likewise.
You have to use like this :
if let statusBar: UIView = UIApplication.shared.value(forKey: "statusBar") as? UIView {
statusBar.backgroundColor = UIColor.purple
}
If you want to change the status bar color all over the app, use it in appdelegate->didFinishLaunchingWithOptions
. Or if you want to change for any particular screen, then call it in the particular viewDidLoad
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With