Skip to content

Commit

Permalink
fix selection on longPress
Browse files Browse the repository at this point in the history
  • Loading branch information
Viacheslav80 committed Jun 29, 2021
1 parent 44cf52a commit a1f2c94
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/components/PressableWithSecondaryInteraction/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,20 @@ class PressableWithSecondaryInteraction extends Component {
this.props.forwardedRef(this.pressableRef);
}
this.pressableRef.addEventListener('contextmenu', this.executeSecondaryInteractionOnContextMenu);
this.pressableRef.addEventListener('touchstart', this.preventDefault);
}

componentWillUnmount() {
this.pressableRef.removeEventListener('contextmenu', this.executeSecondaryInteractionOnContextMenu);
this.pressableRef.removeEventListener('touchstart', this.preventDefault);
}

/**
* @param {touchstart} e - TouchEvent.
* https://developer.mozilla.org/en-US/docs/Web/API/TouchEvent
*/
preventDefault = (e) => {
e.preventDefault();
}

/**
Expand Down

0 comments on commit a1f2c94

Please sign in to comment.