11import 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' ;
33import { shallowEqual , swapArrayElements } from './utils' ;
44import Row from './Row' ;
55
@@ -21,6 +21,7 @@ export default class SortableList extends Component {
2121 sortingEnabled : PropTypes . bool ,
2222 scrollEnabled : PropTypes . bool ,
2323 horizontal : PropTypes . bool ,
24+ refreshControl : PropTypes . object ,
2425
2526 renderRow : PropTypes . func . isRequired ,
2627
@@ -148,16 +149,27 @@ export default class SortableList extends Component {
148149 const { contentContainerStyle, horizontal, style : containerStyle } = this . props ;
149150 const { contentHeight, contentWidth, scrollEnabled} = this . state ;
150151 const innerContainerStyle = [ styles . container ] ;
152+ let refreshControl = this . props . refreshControl ;
151153
152154 if ( horizontal ) {
153155 innerContainerStyle . push ( { width : contentWidth } ) ;
154156 } else {
155157 innerContainerStyle . push ( { height : contentHeight } ) ;
156158 }
157159
160+ if ( refreshControl ) {
161+ refreshControl = (
162+ < RefreshControl
163+ { ...this . props . refreshControl . props }
164+ enabled = { scrollEnabled }
165+ />
166+ )
167+ }
168+
158169 return (
159170 < Animated . View style = { containerStyle } ref = { this . _onRefContainer } >
160171 < ScrollView
172+ refreshControl = { refreshControl }
161173 ref = { this . _onRefScrollView }
162174 horizontal = { horizontal }
163175 contentContainerStyle = { contentContainerStyle }
0 commit comments