Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

StatusBarSizeIOS.currentHeight === null ? #9

Open
pavlelekic opened this issue May 13, 2016 · 5 comments
Open

StatusBarSizeIOS.currentHeight === null ? #9

pavlelekic opened this issue May 13, 2016 · 5 comments

Comments

@pavlelekic
Copy link

Hi,
I have some issues getting the status bar size, in getInitialState() I get null when calling StatusBarSizeIOS.currentHeight.

Also, if I do device rotate left nothing will trigger, but then when I do device rotate right I get a 'willChange' event, and the value I get is 0, which is wrong completely.

So basically, I cannot get status bar size at all, and in rare occasions when I do get a value- it's wrong.

@pavlelekic
Copy link
Author

pavlelekic commented May 13, 2016

Btw, these are my dependencies from package.json

  "dependencies": {
    "react": "^0.14.7",
    "react-native": "^0.25.1",
    "react-native-shake-event-ios": "^1.0.3"
  },

The code is the same as your example, I just copy & pasted it from your README.md

@narek11
Copy link

narek11 commented Oct 17, 2017

@pavlelekic I get the same null value for the height.

Did you manage to solve this?
Though I got the react-native-status-bar-height package showing the correct height for me.

@Naoto-Ida
Copy link

Naoto-Ida commented Nov 23, 2017

@narek11 FYI that package is no better than hardcoding a status bar height via a constant so I wouldn't use it.
This package actually listens to status bar frame changes sent from the native side.

With that said, it seems flaky right now. I get null, 0, 20 randomly.

@ErkanSensei
Copy link

If you're looking for just the height of the header, you can do

import { NativeModules } from 'react-native';
const { StatusBarManager } = NativeModules;

  StatusBarManager.getHeight(
    (statusBarFrameData) => {
      console.log(statusBarFrameData.height);
    }
  );

@Waltari10
Copy link

Any way to listen to the StatusBar height change using StatusBarManager?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants