How to find height of status bar in Android through React Native?

Zohar Levin picture Zohar Levin · Feb 16, 2016 · Viewed 57.1k times · Source

How can I find the height of the status bar on Android through React Native?

If I check the React.Dimensions height the value seems to include the status bar height too but I'm trying to find the height of the layout without the status bar.

Answer

IjzerenHein picture IjzerenHein · Aug 3, 2016

You don't need any plugins for this (anymore), just use StatusBar.currentHeight:

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

EDIT: Apparently this does seem to work on Android always, but on iOS, initially undefined is indeed returned :(