Skip to content

Commit

Permalink
Fix for non-passive event warning
Browse files Browse the repository at this point in the history
  • Loading branch information
marekrozmus committed Feb 26, 2023
1 parent 655ce8b commit c202f19
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 17 deletions.
28 changes: 17 additions & 11 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 8 additions & 6 deletions src/SwipeableListItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ const ActionAnimation = {
};

const DragDirection = {
UP: "up",
DOWN: "down",
LEFT: "left",
RIGHT: "right",
UNKNOWN: "unknown",
UP: 'up',
DOWN: 'down',
LEFT: 'left',
RIGHT: 'right',
UNKNOWN: 'unknown',
};

const FPS_INTERVAL = 1000 / 60;
Expand Down Expand Up @@ -111,7 +111,9 @@ class SwipeableListItem extends PureComponent {
componentDidMount() {
this.listElement.addEventListener('mousedown', this.handleDragStartMouse);

this.listElement.addEventListener('touchstart', this.handleDragStartTouch);
this.listElement.addEventListener('touchstart', this.handleDragStartTouch, {
passive: true,
});
this.listElement.addEventListener('touchend', this.handleDragEndTouch);
this.listElement.addEventListener('touchmove', this.handleTouchMove, {
capture: true,
Expand Down

0 comments on commit c202f19

Please sign in to comment.