Skip to content

Instantly share code, notes, and snippets.

@johanneslumpe
Created April 15, 2015 14:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save johanneslumpe/e48acd0a820bb322790b to your computer and use it in GitHub Desktop.
Save johanneslumpe/e48acd0a820bb322790b to your computer and use it in GitHub Desktop.
Get react-native view dimensions
var UIManager = require('NativeModules').UIManager;
// in your component, use whatever ref you have defined on the
// view you want to measure
UIManager.measure(this.refs.view.getNodeHandle(), (frameX, frameX, frameWidth, frameHeight, pageX, pageY) => {
// do something with the measured values
});
@gre
Copy link

gre commented Aug 5, 2015

you can (now?) directly do:

this.refs.view.measure((frameX, frameY, frameWidth, frameHeight, pageX, pageY) => {

});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment