I can't seem to find a way to change the colors of the status bar icons to white - at the top of the screen, e.g time & battery.
I've tried adding the following in info.plist
But only seems to work in previous versions of IOS. Any help much appreciated.
Open the file App. import GeneralStatusBarColor from './src/components/GeneralStatusBarColor';... barStyle="light-content"/><View style={styles. container}><Text style={styles. welcome}>Welcome to React Native!
You can't change the color of the iOS status bar. You can use the React Native StatusBar module to either hide it, or set the text color to light (white) or dark (black).
Add the following code in your android/app/src/main/res/value/colors. xml file. If the file is not there then you can create a new file and add the following code in that particular file. Your icon file should be in a drawable folder with ic_notification name.
Step 1: After opening the android studio and creating a new project with an empty activity. 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, add this code in your onCreate method.
You need to use StatusBarIOS
inside your React Native component:
StatusBarIOS.setStyle('light-content')
Docs here: http://facebook.github.io/react-native/docs/statusbarios.html#content
Edit: As of RN 0.22, StatusBarIOS
has been deprecated and the cross-platform StatusBar
should be used. It has still be used imperatively as is mentioned above:
StatusBar.setBarStyle('light-content', true);
However, the recommended way to use this component is declaratively. For example:
<View>
<StatusBar
backgroundColor="blue"
barStyle="light-content"
/>
<Navigator
initialRoute={{statusBarHidden: true}}
renderScene={(route, navigator) =>
<View>
<StatusBar hidden={route.statusBarHidden} />
...
</View>
}
/>
</View>
See the new docs here: http://facebook.github.io/react-native/docs/statusbar.html
I faced the same problem. Following docs (https://reactnative.dev/docs/statusbar#barstyle) didn't help.
So, I just did a Opt+Click
on StatusBar component to found what props you can change, and what methods it provides.
Snippet of props I found:
export declare type StatusBarStyle = 'auto' | 'inverted' | 'light' | 'dark';
export declare type StatusBarAnimation = 'none' | 'fade' | 'slide';
export declare type StatusBarProps = {
/**
* Sets the color of the status bar text. Default value is "auto" which
* picks the appropriate value according to the active color scheme, eg:
* if your app is dark mode, the style will be "light".
*/
style?: StatusBarStyle;
I used this information and updated the StatusBar component like so:
<StatusBar style="light" />
And voilla, I changed the icons and text color to white!
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