1
1
import React , { Component , PropTypes } from 'react' ;
2
- import { Animated , ScrollView , View , StyleSheet , Platform } from 'react-native' ;
2
+ import { Animated , ScrollView , View , StyleSheet , Platform , RefreshControl } from 'react-native' ;
3
3
import { shallowEqual , swapArrayElements } from './utils' ;
4
4
import Row from './Row' ;
5
5
@@ -21,6 +21,7 @@ export default class SortableList extends Component {
21
21
sortingEnabled : PropTypes . bool ,
22
22
scrollEnabled : PropTypes . bool ,
23
23
horizontal : PropTypes . bool ,
24
+ refreshControl : PropTypes . object ,
24
25
25
26
renderRow : PropTypes . func . isRequired ,
26
27
@@ -148,16 +149,27 @@ export default class SortableList extends Component {
148
149
const { contentContainerStyle, horizontal, style : containerStyle } = this . props ;
149
150
const { contentHeight, contentWidth, scrollEnabled} = this . state ;
150
151
const innerContainerStyle = [ styles . container ] ;
152
+ let refreshControl = this . props . refreshControl ;
151
153
152
154
if ( horizontal ) {
153
155
innerContainerStyle . push ( { width : contentWidth } ) ;
154
156
} else {
155
157
innerContainerStyle . push ( { height : contentHeight } ) ;
156
158
}
157
159
160
+ if ( refreshControl ) {
161
+ refreshControl = (
162
+ < RefreshControl
163
+ { ...this . props . refreshControl . props }
164
+ enabled = { scrollEnabled }
165
+ />
166
+ )
167
+ }
168
+
158
169
return (
159
170
< Animated . View style = { containerStyle } ref = { this . _onRefContainer } >
160
171
< ScrollView
172
+ refreshControl = { refreshControl }
161
173
ref = { this . _onRefScrollView }
162
174
horizontal = { horizontal }
163
175
contentContainerStyle = { contentContainerStyle }
0 commit comments