@@ -31,7 +31,7 @@ function MergeRecursive(obj1, obj2) {
31
31
var GiftedSpinner = require ( 'react-native-gifted-spinner' ) ;
32
32
33
33
var GiftedListView = React . createClass ( {
34
-
34
+
35
35
getDefaultProps ( ) {
36
36
return {
37
37
customStyles : { } ,
@@ -45,7 +45,7 @@ var GiftedListView = React.createClass({
45
45
sectionHeaderView : null ,
46
46
withSections : false ,
47
47
onFetch ( page , callback , options ) { callback ( [ ] ) ; } ,
48
-
48
+
49
49
paginationFetchigView : null ,
50
50
paginationAllLoadedView : null ,
51
51
paginationWaitingView : null ,
@@ -60,7 +60,7 @@ var GiftedListView = React.createClass({
60
60
} ,
61
61
} ;
62
62
} ,
63
-
63
+
64
64
propTypes : {
65
65
customStyles : React . PropTypes . object ,
66
66
initialListSize : React . PropTypes . number ,
@@ -73,7 +73,7 @@ var GiftedListView = React.createClass({
73
73
sectionHeaderView : React . PropTypes . func ,
74
74
withSections : React . PropTypes . bool ,
75
75
onFetch : React . PropTypes . func ,
76
-
76
+
77
77
paginationFetchigView : React . PropTypes . func ,
78
78
paginationAllLoadedView : React . PropTypes . func ,
79
79
paginationWaitingView : React . PropTypes . func ,
@@ -84,20 +84,20 @@ var GiftedListView = React.createClass({
84
84
renderSeparator : React . PropTypes . func ,
85
85
PullToRefreshViewAndroidProps : React . PropTypes . object ,
86
86
} ,
87
-
87
+
88
88
_setY ( y ) { this . _y = y ; } ,
89
89
_getY ( y ) { return this . _y ; } ,
90
90
_setPage ( page ) { this . _page = page ; } ,
91
91
_getPage ( ) { return this . _page ; } ,
92
92
_setRows ( rows ) { this . _rows = rows ; } ,
93
93
_getRows ( ) { return this . _rows ; } ,
94
-
95
-
94
+
95
+
96
96
paginationFetchigView ( ) {
97
97
if ( this . props . paginationFetchigView ) {
98
98
return this . props . paginationFetchigView ( ) ;
99
99
}
100
-
100
+
101
101
return (
102
102
< View style = { [ this . defaultStyles . paginationView , this . props . customStyles . paginationView ] } >
103
103
< GiftedSpinner />
@@ -108,7 +108,7 @@ var GiftedListView = React.createClass({
108
108
if ( this . props . paginationAllLoadedView ) {
109
109
return this . props . paginationAllLoadedView ( ) ;
110
110
}
111
-
111
+
112
112
return (
113
113
< View style = { [ this . defaultStyles . paginationView , this . props . customStyles . paginationView ] } >
114
114
< Text style = { [ this . defaultStyles . actionsLabel , this . props . customStyles . actionsLabel ] } >
@@ -121,9 +121,9 @@ var GiftedListView = React.createClass({
121
121
if ( this . props . paginationWaitingView ) {
122
122
return this . props . paginationWaitingView ( paginateCallback ) ;
123
123
}
124
-
124
+
125
125
return (
126
- < TouchableHighlight
126
+ < TouchableHighlight
127
127
underlayColor = '#c8c7cc'
128
128
onPress = { paginateCallback }
129
129
style = { [ this . defaultStyles . paginationView , this . props . customStyles . paginationView ] }
@@ -157,7 +157,7 @@ var GiftedListView = React.createClass({
157
157
if ( this . props . refreshableWillRefreshView ) {
158
158
return this . props . refreshableWillRefreshView ( ) ;
159
159
}
160
-
160
+
161
161
return (
162
162
< View >
163
163
< View style = { [ this . defaultStyles . refreshableView , this . props . customStyles . refreshableView ] } >
@@ -173,7 +173,7 @@ var GiftedListView = React.createClass({
173
173
if ( this . props . refreshableWaitingView ) {
174
174
return this . props . refreshableWaitingView ( refreshCallback ) ;
175
175
}
176
-
176
+
177
177
return (
178
178
< View >
179
179
< View style = { [ this . defaultStyles . refreshableView , this . props . customStyles . refreshableView ] } >
@@ -189,14 +189,14 @@ var GiftedListView = React.createClass({
189
189
if ( this . props . emptyView ) {
190
190
return this . props . emptyView ( refreshCallback ) ;
191
191
}
192
-
192
+
193
193
return (
194
194
< View style = { [ this . defaultStyles . defaultView , this . props . customStyles . defaultView ] } >
195
195
< Text style = { [ this . defaultStyles . defaultViewTitle , this . props . customStyles . defaultViewTitle ] } >
196
196
Sorry, there is no content to display
197
197
</ Text >
198
-
199
- < TouchableHighlight
198
+
199
+ < TouchableHighlight
200
200
underlayColor = '#c8c7cc'
201
201
onPress = { refreshCallback }
202
202
>
@@ -211,12 +211,12 @@ var GiftedListView = React.createClass({
211
211
if ( this . props . renderSeparator ) {
212
212
return this . props . renderSeparator ( ) ;
213
213
}
214
-
214
+
215
215
return (
216
216
< View style = { [ this . defaultStyles . separator , this . props . customStyles . separator ] } />
217
217
) ;
218
218
} ,
219
-
219
+
220
220
getInitialState ( ) {
221
221
222
222
if ( this . props . refreshable === true && Platform . OS !== 'android' ) {
@@ -243,7 +243,7 @@ var GiftedListView = React.createClass({
243
243
} else {
244
244
ds = new ListView . DataSource ( {
245
245
rowHasChanged : ( row1 , row2 ) => row1 !== row2 ,
246
- } ) ;
246
+ } ) ;
247
247
return {
248
248
dataSource : ds . cloneWithRows ( this . _getRows ( ) ) ,
249
249
refreshStatus : 'waiting' ,
@@ -265,7 +265,7 @@ var GiftedListView = React.createClass({
265
265
_refresh ( ) {
266
266
this . _onRefresh ( { external : true } ) ;
267
267
} ,
268
-
268
+
269
269
_onRefresh ( options = { } ) {
270
270
this . _scrollResponder . scrollTo ( 0 ) ;
271
271
this . setState ( {
@@ -275,23 +275,23 @@ var GiftedListView = React.createClass({
275
275
this . _setPage ( 1 ) ;
276
276
this . props . onFetch ( this . _getPage ( ) , this . _postRefresh , options ) ;
277
277
} ,
278
-
278
+
279
279
_postRefresh ( rows = [ ] , options = { } ) {
280
280
this . _updateRows ( rows , options ) ;
281
- if ( this . props . refreshable === true ) {
281
+ if ( this . props . refreshable === true && Platform . OS !== 'android' ) {
282
282
// @issue
283
283
// if a scrolling is already in progress, this scroll will not be executed
284
- this . _scrollResponder . scrollTo ( this . props . refreshableViewHeight ) ;
284
+ this . _scrollResponder . scrollTo ( this . props . refreshableViewHeight ) ;
285
285
}
286
286
} ,
287
-
287
+
288
288
_onPaginate ( ) {
289
289
this . setState ( {
290
290
paginationStatus : 'fetching' ,
291
291
} ) ;
292
292
this . props . onFetch ( this . _getPage ( ) + 1 , this . _postPaginate , { } ) ;
293
293
} ,
294
-
294
+
295
295
_postPaginate ( rows = [ ] , options = { } ) {
296
296
this . _setPage ( this . _getPage ( ) + 1 ) ;
297
297
var mergedRows = null ;
@@ -302,7 +302,7 @@ var GiftedListView = React.createClass({
302
302
}
303
303
this . _updateRows ( mergedRows , options ) ;
304
304
} ,
305
-
305
+
306
306
_updateRows ( rows = [ ] , options = { } ) {
307
307
this . _setRows ( rows ) ;
308
308
if ( this . props . withSections === true ) {
@@ -318,10 +318,10 @@ var GiftedListView = React.createClass({
318
318
refreshStatus : 'waiting' ,
319
319
isRefreshing : false ,
320
320
paginationStatus : ( options . allLoaded === true ? 'allLoaded' : 'waiting' ) ,
321
- } ) ;
321
+ } ) ;
322
322
}
323
323
} ,
324
-
324
+
325
325
_onResponderRelease ( ) {
326
326
if ( this . props . refreshable === true ) {
327
327
if ( Platform . OS !== 'android' ) {
@@ -331,12 +331,12 @@ var GiftedListView = React.createClass({
331
331
}
332
332
}
333
333
} ,
334
-
334
+
335
335
_onScroll ( e ) {
336
336
this . _setY ( e . nativeEvent . contentOffset . y ) ;
337
337
if ( this . props . refreshable === true ) {
338
338
if ( Platform . OS !== 'android' ) {
339
- if ( this . _getY ( ) < this . props . refreshableViewHeight - this . props . refreshableDistance
339
+ if ( this . _getY ( ) < this . props . refreshableViewHeight - this . props . refreshableDistance
340
340
&& this . state . refreshStatus === 'waiting'
341
341
&& this . _scrollResponder . scrollResponderHandleScrollShouldSetResponder ( ) === true
342
342
) {
@@ -348,7 +348,7 @@ var GiftedListView = React.createClass({
348
348
}
349
349
}
350
350
} ,
351
-
351
+
352
352
_renderRefreshView ( ) {
353
353
switch ( this . state . refreshStatus ) {
354
354
case 'fetching' :
@@ -361,7 +361,7 @@ var GiftedListView = React.createClass({
361
361
return this . refreshableWaitingView ( this . _onRefresh ) ;
362
362
}
363
363
} ,
364
-
364
+
365
365
_renderPaginationView ( ) {
366
366
if ( ( this . state . paginationStatus === 'fetching' && this . props . pagination === true ) || ( this . state . paginationStatus === 'firstLoad' && this . props . firstLoader === true ) ) {
367
367
return this . paginationFetchigView ( ) ;
@@ -383,16 +383,16 @@ var GiftedListView = React.createClass({
383
383
return { top : 0 , bottom : 0 , left : 0 , right : 0 } ;
384
384
}
385
385
} ,
386
-
386
+
387
387
_calculateContentOffset ( ) {
388
388
if ( this . props . refreshable === true && Platform . OS !== 'android' ) {
389
389
return { x : 0 , y : this . props . refreshableViewHeight } ;
390
390
} else {
391
391
return { x : 0 , y : 0 } ;
392
392
}
393
393
} ,
394
-
395
-
394
+
395
+
396
396
renderListView ( style = { } ) {
397
397
return (
398
398
< ListView
@@ -403,23 +403,23 @@ var GiftedListView = React.createClass({
403
403
404
404
renderHeader = { this . props . refreshable === true && Platform . OS !== 'android' ? this . _renderRefreshView : this . headerView }
405
405
renderFooter = { this . _renderPaginationView }
406
-
406
+
407
407
onScroll = { this . props . refreshable === true && Platform . OS !== 'android' ? this . _onScroll : null }
408
408
onResponderRelease = { this . props . refreshable === true && Platform . OS !== 'android' ? this . _onResponderRelease : null }
409
409
410
410
scrollEventThrottle = { 200 }
411
-
411
+
412
412
contentInset = { this . _calculateContentInset ( ) }
413
413
contentOffset = { this . _calculateContentOffset ( ) }
414
-
414
+
415
415
automaticallyAdjustContentInsets = { false }
416
416
scrollEnabled = { true }
417
417
canCancelContentTouches = { true }
418
-
418
+
419
419
renderSeparator = { this . renderSeparator }
420
-
420
+
421
421
{ ...this . props }
422
-
422
+
423
423
style = { [ this . props . style , style ] }
424
424
/>
425
425
) ;
@@ -433,7 +433,7 @@ var GiftedListView = React.createClass({
433
433
onRefresh = { this . _onRefresh }
434
434
435
435
{ ...this . props . PullToRefreshViewAndroidProps }
436
-
436
+
437
437
style = { [ this . props . PullToRefreshViewAndroidProps . style , { flex : 1 } ] }
438
438
>
439
439
{ this . renderListView ( { flex : 1 } ) }
@@ -443,7 +443,7 @@ var GiftedListView = React.createClass({
443
443
return this . renderListView ( ) ;
444
444
}
445
445
} ,
446
-
446
+
447
447
defaultStyles : {
448
448
separator : {
449
449
height : 1 ,
0 commit comments