Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

react-native statusBar with expo on iOS

I was trying to change the color of the statusBar on my react-native app.

I am working with expo and on their documentation they are just specifying to add : "androidStatusBar": { "backgroundColor": "#2E1D59" }

that works fine with android, but they did not mention how to do so with iOS statusBar.

Anyone has an idea about this ?

like image 331
Ayyoub Avatar asked Jan 12 '18 17:01

Ayyoub


People also ask

What is Expo StatusBar?

expo-status-bar gives you a component and imperative interface to control the app status bar to change its text color, background color, hide it, make it translucent or opaque, and apply animations to any of these changes.

What is StatusBar in react-native?

StatusBar is a component exported by the react-native library that helps to modify and style the native status bar in Android and iOS devices.

How do I change the color of my status bar in Expo?

If you use expo-status-bar to control your status bar style, the style="auto" configuration will automatically pick the appropriate default style depending on the color scheme currently used by the app (this is the default behavior, if you leave out the style prop entirely then auto will be used).


1 Answers

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).

You can just drop the component in your app's root component:

 <StatusBar barStyle="light-content" /> 
like image 166
jevakallio Avatar answered Sep 19 '22 16:09

jevakallio