I'm developing an app using React Native, I've been asked to set the text color of the status bar in white.
I used the StatusBar component with the property barStyle="light-content" and it works pretty well on Android but not on iOS, the text color is still black.
I did some research about it but I couldn't find anything helpful. I even tried to select the Light Status bar style on XCode like the following picture shows but it still doesn't work
Add import { StatusBar } from 'react-native'; to the top of your app. js and then add StatusBar. setBarStyle('light-content', true); as the first line in your render() to change the status bar text/icons to white. The other color options are 'default' and 'dark-content' .
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.
setBackgroundColor() Set the background color for the status bar. Background color. Animate the style change.
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).
I solved the problem! I use this code in Index page and set the text color to white:
<StatusBar barStyle="light-content" translucent={true} />
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