@@ -27,8 +27,12 @@ export default class SortableList extends Component {
2727 showsHorizontalScrollIndicator : PropTypes . bool ,
2828 refreshControl : PropTypes . element ,
2929 autoscrollAreaSize : PropTypes . number ,
30+ snapToAlignment : PropTypes . string ,
3031 rowActivationTime : PropTypes . number ,
3132 manuallyActivateRows : PropTypes . bool ,
33+ scrollEventThrottle : PropTypes . number ,
34+ decelerationRate : PropTypes . oneOf ( [ PropTypes . string , PropTypes . number ] ) ,
35+ pagingEnabled : PropTypes . bool ,
3236 nestedScrollEnabled : PropTypes . bool ,
3337 disableIntervalMomentum : PropTypes . bool ,
3438
@@ -39,15 +43,21 @@ export default class SortableList extends Component {
3943 onChangeOrder : PropTypes . func ,
4044 onActivateRow : PropTypes . func ,
4145 onReleaseRow : PropTypes . func ,
46+ onScroll : PropTypes . func ,
4247 } ;
4348
4449 static defaultProps = {
4550 sortingEnabled : true ,
4651 scrollEnabled : true ,
4752 autoscrollAreaSize : 60 ,
53+ snapToAlignment : 'start' ,
4854 manuallyActivateRows : false ,
4955 showsVerticalScrollIndicator : true ,
50- showsHorizontalScrollIndicator : true
56+ showsHorizontalScrollIndicator : true ,
57+ scrollEventThrottle : 2 ,
58+ decelerationRate : 'normal' ,
59+ pagingEnabled : false ,
60+ onScroll : ( ) => { }
5161 }
5262
5363 /**
@@ -134,12 +144,15 @@ export default class SortableList extends Component {
134144 }
135145
136146 componentDidUpdate ( prevProps , prevState ) {
137- const { data} = this . state ;
147+ const { data, scrollEnabled } = this . state ;
138148 const { data : prevData } = prevState ;
139149
140150 if ( data && prevData && ! shallowEqual ( data , prevData ) ) {
141151 this . _onUpdateLayouts ( ) ;
142152 }
153+ if ( prevProps . scrollEnabled !== scrollEnabled ) {
154+ this . setState ( { scrollEnabled : prevProps . scrollEnabled } )
155+ }
143156 }
144157
145158 scrollBy ( { dx = 0 , dy = 0 , animated = false } ) {
@@ -194,7 +207,20 @@ export default class SortableList extends Component {
194207 }
195208
196209 render ( ) {
197- let { contentContainerStyle, innerContainerStyle, horizontal, style, showsVerticalScrollIndicator, showsHorizontalScrollIndicator, nestedScrollEnabled, disableIntervalMomentum} = this . props ;
210+ let {
211+ contentContainerStyle,
212+ innerContainerStyle,
213+ horizontal,
214+ style,
215+ showsVerticalScrollIndicator,
216+ showsHorizontalScrollIndicator,
217+ snapToAlignment,
218+ scrollEventThrottle,
219+ decelerationRate,
220+ pagingEnabled,
221+ nestedScrollEnabled,
222+ disableIntervalMomentum,
223+ } = this . props ;
198224 const { animated, contentHeight, contentWidth, scrollEnabled} = this . state ;
199225 const containerStyle = StyleSheet . flatten ( [ style , { opacity : Number ( animated ) } ] )
200226 innerContainerStyle = [
@@ -219,11 +245,15 @@ export default class SortableList extends Component {
219245 ref = { this . _onRefScrollView }
220246 horizontal = { horizontal }
221247 contentContainerStyle = { contentContainerStyle }
222- scrollEventThrottle = { 2 }
248+ scrollEventThrottle = { scrollEventThrottle }
249+ pagingEnabled = { pagingEnabled }
250+ decelerationRate = { decelerationRate }
223251 scrollEnabled = { scrollEnabled }
224252 showsHorizontalScrollIndicator = { showsHorizontalScrollIndicator }
225253 showsVerticalScrollIndicator = { showsVerticalScrollIndicator }
226- onScroll = { this . _onScroll } >
254+ snapToAlignment = { snapToAlignment }
255+ onScroll = { this . _onScroll }
256+ >
227257 { this . _renderHeader ( ) }
228258 < View style = { innerContainerStyle } >
229259 { this . _renderRows ( ) }
@@ -625,8 +655,9 @@ export default class SortableList extends Component {
625655 }
626656 } ;
627657
628- _onScroll = ( { nativeEvent : { contentOffset} } ) => {
629- this . _contentOffset = contentOffset ;
658+ _onScroll = ( e ) => {
659+ this . _contentOffset = e . nativeEvent . contentOffset ;
660+ this . props . onScroll ( e )
630661 } ;
631662
632663 _onRefContainer = ( component ) => {
0 commit comments