@@ -11,8 +11,7 @@ import {
1111 ActivityIndicator
1212} from 'react-native' ;
1313
14- import TimerMixin from 'react-timer-mixin' ;
15- import RefreshInfiniteListView from '@remobile/react-native-refresh-infinite-listview' ;
14+ import InfiniteScrollView from 'react-native-infinite-scroll-view' ;
1615
1716export default class InitialScreen extends Component {
1817
@@ -23,7 +22,8 @@ export default class InitialScreen extends Component {
2322 isLoading : true ,
2423 dataSource : new ListView . DataSource ( {
2524 rowHasChanged : ( row1 , row2 ) => row1 !== row2
26- } )
25+ } ) ,
26+ canLoadMoreContent : true
2727 } ;
2828 } ;
2929
@@ -38,16 +38,15 @@ export default class InitialScreen extends Component {
3838 this . setState ( {
3939 isLoading : false ,
4040 dataSource : this . state . dataSource . cloneWithRows ( feeds )
41+
4142 } ) ;
4243 } ) . done ( ) ;
4344 } ;
4445
45- onRefresh ( ) {
46- this . fetchData ;
47- /* this.setTimeout(()=>{
48- this.list.hideHeader();
49- }, 1000); */
50- } ;
46+ loadMoreContentAsync = async ( ) => {
47+ console . log ( "here" ) ;
48+
49+ }
5150
5251 genRows ( pressData : { [ key : number ] : boolean } ) : Array < string > {
5352 let data = [ ] ;
@@ -93,16 +92,6 @@ export default class InitialScreen extends Component {
9392 } ;
9493
9594
96- onInfinite ( ) {
97- this . fetchData ( ) ;
98- this . setTimeout ( ( ) => {
99- this . list . hideFooter ( ) ;
100-
101- } , 1000 ) ;
102- } ;
103- loadedAllData ( ) {
104- return this . data . index >= this . data . maxIndex || this . data . index === 0 ;
105- } ;
10695
10796 render ( ) {
10897 const rightButtonConfig = {
@@ -117,34 +106,13 @@ export default class InitialScreen extends Component {
117106 } ;
118107
119108 return (
120- /* <View style={{ flex: 1, backgroundColor: '#ff9900', }}>
121- <NavigationBar
122- title={{ title: 'Title', }}
123- rightButton={rightButtonConfig} />
124- /* <ListView
125- dataSource={this.state.dataSource}
126- renderRow={(this.renderRow.bind(this))}
127- renderSeparator={this.renderSeparator}
128- /> */
129-
130- < View style = { { flex :1 } } >
131- < View style = { { height :20 } } />
132- < RefreshInfiniteListView
133- ref = { ( list ) => { this . list = list } }
134- dataSource = { this . state . dataSource }
135- renderRow = { this . renderRow }
136- renderSeparator = { this . renderSeparator }
137- loadedAllData = { this . loadedAllData }
138- initialListSize = { 30 }
139- scrollEventThrottle = { 10 }
140- style = { { backgroundColor :'transparent' /*,top:100, left:10, width:200, height:300, position:'absolute'*/ } }
141- onRefresh = { this . onRefresh }
142- onInfinite = { this . onInfinite }
143- >
144- </ RefreshInfiniteListView >
145- </ View >
146-
147- /* </View>*/
109+ < ListView
110+ renderScrollComponent = { props => < InfiniteScrollView { ...props } /> }
111+ dataSource = { this . state . dataSource }
112+ renderRow = { this . renderRow }
113+ canLoadMore = { this . state . canLoadMoreContent }
114+ onLoadMoreAsync = { this . loadMoreContentAsync }
115+ />
148116 ) ;
149117 }
150118}
0 commit comments