Skip to content

Commit 3054049

Browse files
Marek RozmusMarek Rozmus
Marek Rozmus
authored and
Marek Rozmus
committed
Add fixes for iOS
1 parent c9c4cad commit 3054049

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/SwipeableListItem.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,18 @@ class SwipeableListItem extends PureComponent {
4343

4444
componentDidMount() {
4545
this.wrapper.addEventListener('mousedown', this.handleDragStartMouse);
46+
4647
this.wrapper.addEventListener('touchstart', this.handleDragStartTouch);
48+
this.wrapper.addEventListener('touchend', this.handleDragEndTouch);
49+
this.wrapper.addEventListener('touchmove', this.handleTouchMove);
4750
}
4851

4952
componentWillUnmount() {
5053
this.wrapper.removeEventListener('mousedown', this.handleDragStartMouse);
54+
5155
this.wrapper.removeEventListener('touchstart', this.handleDragStartTouch);
56+
this.wrapper.removeEventListener('touchend', this.handleDragEndTouch);
57+
this.wrapper.removeEventListener('touchmove', this.handleTouchMove);
5258
}
5359

5460
handleDragStartMouse = event => {
@@ -64,9 +70,6 @@ class SwipeableListItem extends PureComponent {
6470
handleDragStartTouch = event => {
6571
window.addEventListener('touchend', this.handleDragEndTouch);
6672

67-
this.wrapper.addEventListener('touchend', this.handleDragEndTouch);
68-
this.wrapper.addEventListener('touchmove', this.handleTouchMove);
69-
7073
const touch = event.targetTouches[0];
7174
this.handleDragStart(touch);
7275
};
@@ -123,9 +126,6 @@ class SwipeableListItem extends PureComponent {
123126
handleDragEndTouch = () => {
124127
window.removeEventListener('touchend', this.handleDragEndTouch);
125128

126-
this.wrapper.removeEventListener('touchend', this.handleDragEndTouch);
127-
this.wrapper.removeEventListener('touchmove', this.handleTouchMove);
128-
129129
this.handleDragEnd();
130130
};
131131

0 commit comments

Comments
 (0)