标签:
1 /** 2 * Created by DaGuo on 2016/4/7. 3 */ 4 5 ‘use strict‘ 6 7 import React,{ 8 Component, 9 View, 10 Text, 11 ListView, 12 13 } from ‘react-native‘; 14 15 class ListViewDemo extends Component { 16 constructor (props){ 17 super(props); 18 let ds=new ListView.DataSource({rowHasChanged:(r1,r2) => r1!=r2}); 19 this.state={ 20 dataSoure:ds.cloneWithRows([‘row1‘,‘row2‘]),//返回的也是一个ListView 21 }; 22 } 23 componentWillMount (){ 24 25 } 26 componentDidMount (){ 27 //这里可以异步加载数据或者setTimeout(); 28 } 29 _renderRow (rowData){ 30 31 } 32 render (){ 33 return ( 34 <ListView 35 dataSource={this.state.dataSource} 36 renderRow={this._renderRow(rowData)} 37 initialListSize={300} 38 onChangeVisibleRows={} 39 onEndReached={} 40 onEndReachedThreshold={} 41 pageSize={} 42 removeClippedSubViews={{overflow:"hidden"}} 43 renderFooter={() => renderable} 44 renderHeader={} 45 renderScrollComponent ={(props) => renderable} 46 renderSectionHeader = {} 47 renderSeparator= {} 48 scrollRenderAheadDistance ={} 49 > 50 51 </ListView> 52 ); 53 } 54 55 }
标签:
原文地址:http://www.cnblogs.com/ZSG-DoBestMe/p/5362973.html