@@ -25,6 +25,9 @@ const View = require('View');
2525const  createReactClass  =  require ( 'create-react-class' ) ; 
2626const  emptyFunction  =  require ( 'fbjs/lib/emptyFunction' ) ; 
2727
28+ import  type  { LayoutEvent ,  PressEvent }  from  'CoreEventTypes' ; 
29+ import  type  { GestureState }  from  'PanResponder' ; 
30+ 
2831const  IS_RTL  =  I18nManager . isRTL ; 
2932
3033// NOTE: Eventually convert these consts to an input object of configurations 
@@ -204,24 +207,27 @@ const SwipeableRow = createReactClass({
204207    this . _animateToClosedPosition ( ) ; 
205208  } , 
206209
207-   _onSwipeableViewLayout ( event : Object ) : void  { 
210+   _onSwipeableViewLayout ( event : LayoutEvent ) : void  { 
208211    this . setState ( { 
209212      isSwipeableViewRendered : true , 
210213      rowHeight : event . nativeEvent . layout . height , 
211214    } ) ; 
212215  } , 
213216
214217  _handleMoveShouldSetPanResponderCapture ( 
215-     event : Object , 
216-     gestureState : Object , 
218+     event : PressEvent , 
219+     gestureState : GestureState , 
217220  ) : boolean  { 
218221    // Decides whether a swipe is responded to by this component or its child 
219222    return  gestureState . dy  <  10  &&  this . _isValidSwipe ( gestureState ) ; 
220223  } , 
221224
222-   _handlePanResponderGrant ( event : Object ,  gestureState : Object ) : void  { } , 
225+   _handlePanResponderGrant ( 
226+     event : PressEvent , 
227+     gestureState : GestureState , 
228+   ) : void  { } , 
223229
224-   _handlePanResponderMove ( event : Object ,  gestureState : Object ) : void  { 
230+   _handlePanResponderMove ( event : PressEvent ,  gestureState : GestureState ) : void  { 
225231    if  ( this . _isSwipingExcessivelyRightFromClosedPosition ( gestureState ) )  { 
226232      return ; 
227233    } 
@@ -235,22 +241,24 @@ const SwipeableRow = createReactClass({
235241    } 
236242  } , 
237243
238-   _isSwipingRightFromClosed ( gestureState : Object ) : boolean  { 
244+   _isSwipingRightFromClosed ( gestureState : GestureState ) : boolean  { 
239245    const  gestureStateDx  =  IS_RTL  ? - gestureState . dx  : gestureState . dx ; 
240246    return  this . _previousLeft  ===  CLOSED_LEFT_POSITION  &&  gestureStateDx  >  0 ; 
241247  } , 
242248
243-   _swipeFullSpeed ( gestureState : Object ) : void  { 
249+   _swipeFullSpeed ( gestureState : GestureState ) : void  { 
244250    this . state . currentLeft . setValue ( this . _previousLeft  +  gestureState . dx ) ; 
245251  } , 
246252
247-   _swipeSlowSpeed ( gestureState : Object ) : void  { 
253+   _swipeSlowSpeed ( gestureState : GestureState ) : void  { 
248254    this . state . currentLeft . setValue ( 
249255      this . _previousLeft  +  gestureState . dx  /  SLOW_SPEED_SWIPE_FACTOR , 
250256    ) ; 
251257  } , 
252258
253-   _isSwipingExcessivelyRightFromClosedPosition ( gestureState : Object ) : boolean  { 
259+   _isSwipingExcessivelyRightFromClosedPosition ( 
260+     gestureState : GestureState , 
261+   ) : boolean  { 
254262    /** 
255263     * We want to allow a BIT of right swipe, to allow users to know that 
256264     * swiping is available, but swiping right does not do anything 
@@ -264,8 +272,8 @@ const SwipeableRow = createReactClass({
264272  } , 
265273
266274  _onPanResponderTerminationRequest ( 
267-     event : Object , 
268-     gestureState : Object , 
275+     event : PressEvent , 
276+     gestureState : GestureState , 
269277  ) : boolean  { 
270278    return  false ; 
271279  } , 
@@ -338,7 +346,7 @@ const SwipeableRow = createReactClass({
338346  } , 
339347
340348  // Ignore swipes due to user's finger moving slightly when tapping 
341-   _isValidSwipe ( gestureState : Object ) : boolean  { 
349+   _isValidSwipe ( gestureState : GestureState ) : boolean  { 
342350    if  ( 
343351      this . props . preventSwipeRight  && 
344352      this . _previousLeft  ===  CLOSED_LEFT_POSITION  && 
@@ -350,7 +358,7 @@ const SwipeableRow = createReactClass({
350358    return  Math . abs ( gestureState . dx )  >  HORIZONTAL_SWIPE_DISTANCE_THRESHOLD ; 
351359  } , 
352360
353-   _shouldAnimateRemainder ( gestureState : Object ) : boolean  { 
361+   _shouldAnimateRemainder ( gestureState : GestureState ) : boolean  { 
354362    /** 
355363     * If user has swiped past a certain distance, animate the rest of the way 
356364     * if they let go 
@@ -361,7 +369,7 @@ const SwipeableRow = createReactClass({
361369    ) ; 
362370  } , 
363371
364-   _handlePanResponderEnd ( event : Object ,  gestureState : Object ) : void  { 
372+   _handlePanResponderEnd ( event : PressEvent ,  gestureState : GestureState ) : void  { 
365373    const  horizontalDistance  =  IS_RTL  ? - gestureState . dx  : gestureState . dx ; 
366374    if  ( this . _isSwipingRightFromClosed ( gestureState ) )  { 
367375      this . props . onOpen ( ) ; 
0 commit comments