Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to hide the statusBar when react-native modal shown?

Tags:

react-native

Screenshot of status bar

I want to hide the status bar, when modal window is shown.

My setup is as following, but it won't work as expected:

<StatusBar animated={true} hidden={true}  translucent={true}>
like image 661
Tanker Avatar asked Jul 28 '17 09:07

Tanker


People also ask

How remove StatusBar from react-native?

React Practice Course. The Status bar is easy to use and all you need to do is set properties to change it. The hidden property can be used to hide the status bar. In our example it is set to false. This is default value.

How do I hide modal in react-native?

In the react native example, the modal is shown when the touchableHighlight component is pressed. Inside showModal function, we use setTimeout method to show the modal for five seconds and then the modal is hidden by setting modalVisible false.

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.


1 Answers

Use statusBarTranslucent

If your status bar is translucent, you can set statusBarTranslucent to the modal.

Added since React Native 0.62

<Modal {...props} statusBarTranslucent>...</Modal>

Credit: https://github.com/react-native-modal/react-native-modal/issues/50#issuecomment-607535322

like image 181
cYee Avatar answered Sep 21 '22 07:09

cYee