@@ -43,12 +43,18 @@ class SwipeableListItem extends PureComponent {
43
43
44
44
componentDidMount ( ) {
45
45
this . wrapper . addEventListener ( 'mousedown' , this . handleDragStartMouse ) ;
46
+
46
47
this . wrapper . addEventListener ( 'touchstart' , this . handleDragStartTouch ) ;
48
+ this . wrapper . addEventListener ( 'touchend' , this . handleDragEndTouch ) ;
49
+ this . wrapper . addEventListener ( 'touchmove' , this . handleTouchMove ) ;
47
50
}
48
51
49
52
componentWillUnmount ( ) {
50
53
this . wrapper . removeEventListener ( 'mousedown' , this . handleDragStartMouse ) ;
54
+
51
55
this . wrapper . removeEventListener ( 'touchstart' , this . handleDragStartTouch ) ;
56
+ this . wrapper . removeEventListener ( 'touchend' , this . handleDragEndTouch ) ;
57
+ this . wrapper . removeEventListener ( 'touchmove' , this . handleTouchMove ) ;
52
58
}
53
59
54
60
handleDragStartMouse = event => {
@@ -64,9 +70,6 @@ class SwipeableListItem extends PureComponent {
64
70
handleDragStartTouch = event => {
65
71
window . addEventListener ( 'touchend' , this . handleDragEndTouch ) ;
66
72
67
- this . wrapper . addEventListener ( 'touchend' , this . handleDragEndTouch ) ;
68
- this . wrapper . addEventListener ( 'touchmove' , this . handleTouchMove ) ;
69
-
70
73
const touch = event . targetTouches [ 0 ] ;
71
74
this . handleDragStart ( touch ) ;
72
75
} ;
@@ -123,9 +126,6 @@ class SwipeableListItem extends PureComponent {
123
126
handleDragEndTouch = ( ) => {
124
127
window . removeEventListener ( 'touchend' , this . handleDragEndTouch ) ;
125
128
126
- this . wrapper . removeEventListener ( 'touchend' , this . handleDragEndTouch ) ;
127
- this . wrapper . removeEventListener ( 'touchmove' , this . handleTouchMove ) ;
128
-
129
129
this . handleDragEnd ( ) ;
130
130
} ;
131
131
0 commit comments