Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I retrieve iOS Status Bar height in React-Native app?

For Android I know I can use StatusBar.currentHeight but I'm not sure how to do so for iOS.

The answer to how to retrieve the size in Swift(native) has already been answered but I need this in a react native app.

like image 214
jasan Avatar asked Jun 12 '17 13:06

jasan


People also ask

How do I get the height of the status bar in react-native?

currentHeight : import {StatusBar} from 'react-native'; console. log('statusBarHeight: ', StatusBar. currentHeight);

How does react-native handle status bar?

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.


1 Answers

You can use React Navigation that already have support of iPhone X.

Even if you don't want use this library because of some reason - you still can read source code to copy implementation in your code

like image 105
Oleksandr Cherniavenko Avatar answered Oct 08 '22 17:10

Oleksandr Cherniavenko