title: React Native - how to scroll a ScrollView to a given location after navigation from another screen
body: <p>Is it possible to tell a ScrollView to scroll to a specific position when we just navigated to the current screen via StackNavigator?</p>
  
  <p>I have two screens; Menu and Items. The Menu is a list of Buttons, one for each item. The Items screen contain a Carousel built using ScrollView with the picture and detailed description of each Item.</p>
  
  <p>When I click on a button in the Menu screen, I want to navigate to the Items screen, and automatically scroll to the Item that the button represent. </p>
  
  <p>I read that you can pass in parameters when using the StackNavigator like so: but I don't know how to read out that parameter in my Items screen.</p>
  
  <pre><code>navigate('Items', { id: '1' })
  </code></pre>
  
  <p>So is this something that is possible in React Native and how do I do it? Or perhaps I'm using the wrong navigator?</p>
  
  <p>Here's a dumbed down version of my two screens:</p>
  
  <p>App.js:</p>
  
  <pre><code>const SimpleApp = StackNavigator({
      Menu: { screen: MenuScreen},
      Items: { screen: ItemScreen }
    }
  );
  
  export default class App extends React.Component {
    render() {
      return &lt;SimpleApp /&gt;;
    }
  }
  </code></pre>
  
  <p>Menu.js</p>
  
  <pre><code>export default class Menu extends React.Component {
      constructor(props){
          super(props)
          this.seeDetail = this.seeDetail.bind(this)
      }
  
      seeDetail(){
          const { navigate } = this.props.navigation;
          navigate('Items')
      }
  
      render(){
          &lt;Button onPress={this.seeDetail} title='1'/&gt;
          &lt;Button onPress={this.seeDetail} title='2'/&gt;
      }
  }
  </code></pre>
  
  <p>Items.js</p>
  
  <pre><code>export default class Items extends React.Component {
    render(){
      let scrollItems = [] //Somecode that generates and array of items
      return (
        &lt;View&gt;
          &lt;View style={styles.scrollViewContainer}&gt;
            &lt;ScrollView 
            horizontal
            pagingEnabled
            ref={(ref) =&gt; this.myScroll = ref}&gt;
              {scrollItems}
            &lt;/ScrollView&gt;
          &lt;/View&gt;
        &lt;/View&gt;
      )
    }  
  }
  </code></pre>
  
  <p>P.S I am specifically targeting Android at the moment, but ideally there could be a cross-platform solution.</p>