Select a row in ListView react-native to get detail
<p>i'm new in react-native. I saw an example in <a href="https://facebook.github.io/react-native/docs/sample-application-movies.html" rel="noreferrer">https://facebook.github.io/react-native/docs/sample-application-movies.html</a> .
It is building a movies app that fetch movies and display them in a ListView. How can we select a row to get its detail data and display it in other view? Please help. thanks :)</p>

<p>Here's what i've done so far: </p>

<p><div class="snippet" data-lang="js" data-hide="false" data-console="true">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code>/**
 * Sample React Native App
 * https://github.com/facebook/react-native
 */

import React, {
  Component,
} from 'react';
import {
  AppRegistry,
  Image,
  ListView,
  StyleSheet,
  Text,
  View,
  Navigator,
  TouchableOpacity,
} from 'react-native';

var REQUEST_URL = 'https://raw.githubusercontent.com/facebook/react-native/master/docs/MoviesExample.json';

var SCREEN_WIDTH = require('Dimensions').get('window').width;
var BaseConfig = Navigator.SceneConfigs.FloatFromRight;

var CustomLeftToRightGesture = Object.assign({}, BaseConfig.gestures.pop, {

  snapVelocity: 8,
  edgeHitWidth: SCREEN_WIDTH,
});

var CustomSceneConfig = Object.assign({}, BaseConfig, {
  springTension: 100,
  springFriction: 1,
  gestures: {
    pop: CustomLeftToRightGesture,
  }
});

var PageOne = React.createClass({
  getInitialState:function(){
    return{
      dataSource: new ListView.DataSource({
        rowHasChanged: (row1, row2) =&gt; row1 !== row2,
      }),
      loaded: false,
    }
  },

  componentDidMount() {
    this.fetchData();
  },

  fetchData() {
    fetch(REQUEST_URL)
      .then((response) =&gt; response.json())
      .then((responseData) =&gt; {
        this.setState({
          dataSource: this.state.dataSource.cloneWithRows(responseData.movies),
          loaded: true,
        });
      })
      .done();
  },

  render() {
    if (!this.state.loaded) {
      return this.renderLoadingView();
    }

    return (
      &lt;ListView
        dataSource={this.state.dataSource}
        renderRow={this.renderMovie}
        style={styles.listView}
      /&gt;
    );
  },

  renderLoadingView() {
    return (
      &lt;View style={styles.container}&gt;
        &lt;Text&gt;
          Loading movies...
        &lt;/Text&gt;
      &lt;/View&gt;
    );
  },

  renderMovie(movie) {
    title1 = movie.title;
    year1 = movie.year;

    return (
    &lt;TouchableOpacity onPress={this._handlePressList}&gt;
      &lt;View style={styles.container}&gt;
        &lt;Image
          source={{uri: movie.posters.thumbnail}}
          style={styles.thumbnail}
        /&gt;
        &lt;View style={styles.rightContainer}&gt;
          &lt;Text style={styles.title}&gt;{movie.title}&lt;/Text&gt;
          &lt;Text style={styles.year}&gt;{movie.year}&lt;/Text&gt;
        &lt;/View&gt;
      &lt;/View&gt;
    &lt;/TouchableOpacity&gt;
    );
  },

  _handlePressList(){
    this.props.navigator.push({id: 2, title1, year1});
  },
});

var PageTwo = React.createClass({
  render(){
    return(
      &lt;View style={styles.rightContainer}&gt;
          &lt;Text style={styles.title}&gt;{title1}&lt;/Text&gt;
          &lt;Text style={styles.year}&gt;{year1}&lt;/Text&gt;
        &lt;/View&gt;
    )
  }
})
class SampleAppMovies extends Component{
  _renderScene(route, navigator) {
    if (route.id === 1) {
      return &lt;PageOne navigator={navigator} /&gt;
    } else if (route.id === 2) {
      return &lt;PageTwo navigator={navigator} /&gt;
    }
  }

  _configureScene(route) {
    return CustomSceneConfig;
  }

  render() {
    return (
      &lt;Navigator
        initialRoute={{id: 1, }}
        renderScene={this._renderScene}
        configureScene={this._configureScene} /&gt;
    );
  }
}

var styles = StyleSheet.create({
  container: {
    flex: 1,
    flexDirection: 'row',
    justifyContent: 'center',
    alignItems: 'center',
    backgroundColor: '#F5FCFF',
  },
  rightContainer: {
    flex: 1,
  },
  title: {
    fontSize: 20,
    marginBottom: 8,
    textAlign: 'center',
  },
  year: {
    textAlign: 'center',
  },
  thumbnail: {
    width: 53,
    height: 81,
  },
  listView: {
    paddingTop: 20,
    backgroundColor: '#F5FCFF',
  },
});

module.exports = SampleAppMovies;</code></pre>
</div>
</div>
</p>