refs are undefined in react native
<p>Im new to react-native. Im trying to read x,y co-ordinates of a view inside its parent. Using below code </p>

<pre><code>componentDidMount: function() {
  setTimeout(this.measureView);
},
measureView: function() {
  this.refs.completeView.measure((ox, oy, width, height) =&gt; {
    this.setState({headerHeight: height});
  });
},
render : function(){
return (
  &lt;TouchableHighlight onPress={() =&gt; this.props._pressRow(this.props.currentRowID)}&gt;
    &lt;View style={styles.container}
          ref="completeView"&gt;
      &lt;View style={styles.colorView}&gt;
      &lt;/View&gt;
      &lt;View style={styles.textWrapper}&gt;
        &lt;Text style={styles.text}&gt;{this.props.text}&lt;/Text&gt;
      &lt;/View&gt;
    &lt;/View&gt;
  &lt;/TouchableHighlight&gt;
);
},
</code></pre>

<p>Inside <code>measureView</code>, <code>this.refs</code> is always <code>undefined</code>. Why?</p>

<p>I'm trying to read last view's co-ordinates into <code>ListView</code>, because for some reason I want to render the last row. So is there any other solution for this? </p>

<p>Please also make a note that this class is being exported into its parent class. </p>