content: import React, { Component } from 'react';
  import {
    View,
    ListView
  } from 'react-native';
  
  import Loading       from '../../component/common/loading';
  import ThemeListItem from '../../component/list/theme_list_item';
  
  export default class DailyTheme extends Component {
    constructor(props) {
      super(props);
      const dataSource = new ListView.DataSource({rowHasChanged: (r1, r2)=> r1 !== r2});
      this.state = {
        listResource:[],
        isAllLoad:false,
        pageIndex:1,
        dataSource:dataSource
      };
    }
  
    componentDidMount() {
      this.getData();
    }
    
    assign(responseJson) {
      this.setState({
        listResource:this.state.listResource.concat(responseJson.others),
        pageIndex:this.state.pageIndex+1,
        dataSource:this.state.dataSource.cloneWithRows(this.state.listResource.concat(responseJson.others))
      });
      if (responseJson.others.length < 10) {
        this.setState({
          isAllLoad:true
        });
      }
    }
  
    getData() {
      fetch(this.props.fetchUrl)
      .then((response)=>response.json())
      .then((responseJson)=>{this.assign(responseJson)});
    }
  
    render() {
      if (this.state.listResource.length) {
        return (
          <ListView
            dataSource={this.state.dataSource}
            renderRow={(rowData)=><ThemeListItem data={rowData} navigator={this.props.navigator} />}
          />
        );
      } else {
        return (
          <Loading/>
        );
      }
    }
  
    static defaultProps = {
      fetchUrl:  'http://news-at.zhihu.com/api/4/themes'
    }
    
    static propTypes = {
      fetchUrl:  React.PropTypes.string.isRequired,
      navigator: React.PropTypes.object.isRequired
    }
  }