react-native-status-bar-size
react-native-status-bar-size copied to clipboard
StatusBarSizeIOS.currentHeight === null ?
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.
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
@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.
@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.
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);
}
);
Any way to listen to the StatusBar height change using StatusBarManager?