@@ -51,15 +51,21 @@ class SwipeableListItem extends PureComponent {
51
51
52
52
this . wrapper . addEventListener ( 'touchstart' , this . handleDragStartTouch ) ;
53
53
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
+ } ) ;
55
58
}
56
59
57
60
componentWillUnmount ( ) {
58
61
this . wrapper . removeEventListener ( 'mousedown' , this . handleDragStartMouse ) ;
59
62
60
63
this . wrapper . removeEventListener ( 'touchstart' , this . handleDragStartTouch ) ;
61
64
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
+ } ) ;
63
69
}
64
70
65
71
handleDragStartMouse = event => {
@@ -104,11 +110,13 @@ class SwipeableListItem extends PureComponent {
104
110
if ( this . dragStartedWithinItem ( ) ) {
105
111
this . setDragDirection ( clientX , clientY ) ;
106
112
113
+ if ( ! event . cancelable ) {
114
+ return ;
115
+ }
116
+
107
117
if ( this . isSwiping ( ) ) {
108
118
event . stopPropagation ( ) ;
109
- if ( event . cancelable ) {
110
- event . preventDefault ( ) ;
111
- }
119
+ event . preventDefault ( ) ;
112
120
113
121
const delta = clientX - this . dragStartPoint . x ;
114
122
if ( this . shouldMoveItem ( delta ) ) {
@@ -192,7 +200,7 @@ class SwipeableListItem extends PureComponent {
192
200
horizontalDistance <= this . dragHorizontalDirectionThreshold &&
193
201
verticalDistance <= this . dragVerticalDirectionThreshold
194
202
) {
195
- return DragDirection . UNKNOWN ;
203
+ return ;
196
204
}
197
205
198
206
const angle = Math . atan2 ( y - startY , x - startX ) ;
0 commit comments