@@ -51,15 +51,21 @@ class SwipeableListItem extends PureComponent {
5151
5252 this . wrapper . addEventListener ( 'touchstart' , this . handleDragStartTouch ) ;
5353 this . wrapper . addEventListener ( 'touchend' , this . handleDragEndTouch ) ;
54- this . wrapper . addEventListener ( 'touchmove' , this . handleTouchMove ) ;
54+ this . wrapper . addEventListener ( 'touchmove' , this . handleTouchMove , {
55+ capture : true ,
56+ passive : false
57+ } ) ;
5558 }
5659
5760 componentWillUnmount ( ) {
5861 this . wrapper . removeEventListener ( 'mousedown' , this . handleDragStartMouse ) ;
5962
6063 this . wrapper . removeEventListener ( 'touchstart' , this . handleDragStartTouch ) ;
6164 this . wrapper . removeEventListener ( 'touchend' , this . handleDragEndTouch ) ;
62- this . wrapper . removeEventListener ( 'touchmove' , this . handleTouchMove ) ;
65+ this . wrapper . removeEventListener ( 'touchmove' , this . handleTouchMove , {
66+ capture : true ,
67+ passive : false
68+ } ) ;
6369 }
6470
6571 handleDragStartMouse = event => {
@@ -104,11 +110,13 @@ class SwipeableListItem extends PureComponent {
104110 if ( this . dragStartedWithinItem ( ) ) {
105111 this . setDragDirection ( clientX , clientY ) ;
106112
113+ if ( ! event . cancelable ) {
114+ return ;
115+ }
116+
107117 if ( this . isSwiping ( ) ) {
108118 event . stopPropagation ( ) ;
109- if ( event . cancelable ) {
110- event . preventDefault ( ) ;
111- }
119+ event . preventDefault ( ) ;
112120
113121 const delta = clientX - this . dragStartPoint . x ;
114122 if ( this . shouldMoveItem ( delta ) ) {
@@ -192,7 +200,7 @@ class SwipeableListItem extends PureComponent {
192200 horizontalDistance <= this . dragHorizontalDirectionThreshold &&
193201 verticalDistance <= this . dragVerticalDirectionThreshold
194202 ) {
195- return DragDirection . UNKNOWN ;
203+ return ;
196204 }
197205
198206 const angle = Math . atan2 ( y - startY , x - startX ) ;
0 commit comments