I\'m trying to measure a view using a ref
, but the width
returned is 0 despite the fact that I see the view displayed on the screen (and it\'s far
You want to measure the progress bar onLayout.
var Time = React.createClass({
getInitialState: function() {
return({ progressMaxSize: 0 });
},
measureProgressBar: function() {
this.progressBar.measure(this.setWidthProgressMaxSize);
},
setWidthProgressMaxSize: function(ox, oy, width, height, px, py) {
this.setState({ progressMaxSize: width });
},
render: function() {
return(
{ this.progressBar = c; } onLayout={this.measureProgressBar}>
);
}
});