Description
This only happens on a real device (I'm using OnePlus One). Could not reproduce on an emulator.
- Create an example app that displays the window height.
- Open the app for the first time.
- The height is reported as some value (e.g. 592 for me) -- See screenshot below
- Press home button.
- Go back to the example app.
- See that the window height is now different (e.g. 640 for me) -- See screenshot below
It seems that the first load, the height excludes the soft menu bar, but on subsequent reloads it includes it. (the soft menu bar for me is 48).
Here's the code I was running in my app:
'use strict';
const React = require('react-native');
const {
AppRegistry,
Dimensions,
Text,
View
} = React;
const window = Dimensions.get('window');
const Example = React.createClass({
render() {
return (
<View style={{ flex: 1, justifyContent: 'center', alignItems: 'center' }}>
<Text style={{ fontSize: 48}}>Height is {window.height}</Text>
</View>
);
}
});
AppRegistry.registerComponent('Example', () => Example);