react-native
react-native copied to clipboard
android have not React.NativeModules.UIManager.Dimensions.window object.
Awesome project! Android has React.NativeModules.UIManager.Dimensions.windowPhysicalPixels, it is not different from ios.
harebu
Have you looked into using the Dimensions module?
https://github.com/facebook/react-native/blob/master/Libraries/Utilities/Dimensions.js
var Dimensions = require('Dimensions');
var width = Dimensions.get('window').width
var height = Dimensions.get('window').height
To add on to what @mikearmstrong001 said above, you should try to use Dimensions via the React object:
var { Dimensions } = require('react-native');
var width = Dimensions.get('window').width
var height = Dimensions.get('window').height
In the future it may not be possible to require internal React Native modules directly based off of @providesModule (which is what allows for an un-namespaced require('Dimensions'))
Thank you!