title: ScrollView child element get offset
body: <p>I am creating a horizontal <code>ScrollView</code> navigation bar which needs to have the selected element at the center. Is there a way I can get the position offset of the selected item onPress. This is the code I am working with. onPress of TouchableOpacity should get the position offset of the element. <code>onLayout</code> wouldn't work here because it only fires the event on layout changes. Any help would be appreciated. </p>
  
  <pre><code>render() {
      return (&lt;View style={styles.footerCtr}&gt;
        &lt;ScrollView ref="categoryScrollView" horizontal showsHorizontalScrollIndicator={false}&gt;
          {this.props.categories.map((cat, index) =&gt; {
            const catIndex = index;
            const catName = cat.nativename;
  
            return (
              &lt;View style={catIndex === this.state.selCatIndex ? [styles.catCtr, styles.catSelected] : styles.catCtr} key={catIndex}&gt;
                &lt;TouchableOpacity onPress={this.changeCategory.bind(this, catIndex)}&gt;
                  &lt;Text style={catIndex === this.state.selCatIndex ? [styles.category, styles.catSelText] : styles.category}
                  &gt;{capitalize(catName)}&lt;/Text&gt;
                &lt;/TouchableOpacity&gt;
              &lt;/View&gt;
            );
          })}
        &lt;/ScrollView&gt;
      &lt;/View&gt;);
    }
  </code></pre>