react-native icon indicating copy to clipboard operation
react-native copied to clipboard

android have not React.NativeModules.UIManager.Dimensions.window object.

Open buhe opened this issue 11 years ago • 3 comments

Awesome project! Android has React.NativeModules.UIManager.Dimensions.windowPhysicalPixels, it is not different from ios.

harebu

buhe avatar Sep 16 '15 03:09 buhe

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

mikearmstrong001 avatar Sep 16 '15 07:09 mikearmstrong001

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'))

brentvatne avatar Sep 16 '15 07:09 brentvatne

Thank you!

buhe avatar Sep 16 '15 08:09 buhe