Watch and respond to changes in the iOS status bar height
Switch branches/tags
Clone or download
jgkim Merge pull request #21 from mcharytoniuk/patch-1
Update project name in README
Latest commit 6024182 Dec 31, 2017
Failed to load latest commit information.
.gitignore Drop the native module Sep 20, 2016
StatusBarSizeIOS.js Change the code style a little bit Nov 25, 2017
demo.gif Add demo gif Apr 23, 2015
package.json Bump the version to `0.3.3` Nov 25, 2017


Watch and respond to changes in the iOS status bar height.

Add it to your project

  1. Run npm install react-native-status-bar-size --save
  2. Follow the example below to use it in JS

Deprecated change Event

The change event has been deprecated. The didChange event should be used instead. It's still available but may be removed in a later version.


var MyApp = React.createClass({
   getInitialState: function() {
     return {
       currentStatusBarHeight: StatusBarSizeIOS.currentHeight,

   componentDidMount: function() {
     StatusBarSizeIOS.addEventListener('willChange', this._handleStatusBarSizeWillChange);
     StatusBarSizeIOS.addEventListener('didChange', this._handleStatusBarSizeDidChange);

   componentWillUnmount: function() {
     StatusBarSizeIOS.removeEventListener('willChange', this._handleStatusBarSizeWillChange);
     StatusBarSizeIOS.removeEventListener('didChange', this._handleStatusBarSizeDidChange);

   _handleStatusBarSizeWillChange: function(nextStatusBarHeight) {
     console.log('Will Change: ' + nextStatusBarHeight);

   _handleStatusBarSizeDidChange: function(currentStatusBarHeight) {
     this.setState({ currentStatusBarHeight: currentStatusBarHeight });

   render: function() {
     return (
       <View style={{flex: 1, backgroundColor: 'white', justifyContent: 'center', alignItems: 'center'}}>
         <Text>Current status bar height is: {this.state.currentStatusBarHeight}</Text>

Demo gif