From 10525e4f6fb0e8784d22b50256d7c6ba3cf0659c Mon Sep 17 00:00:00 2001 From: Dominic Date: Wed, 16 Jun 2021 17:59:53 +0800 Subject: [PATCH] Fix dragging of crop on touch devices in React 17+ (regression) --- lib/ReactCrop.js | 5 ++--- package.json | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/ReactCrop.js b/lib/ReactCrop.js index 9eb2778..9b32bc6 100644 --- a/lib/ReactCrop.js +++ b/lib/ReactCrop.js @@ -222,7 +222,7 @@ class ReactCrop extends PureComponent { this.docMoveBound = false; } - onCropMouseTouchDown = e => { + onCropPointerDown = e => { const { crop, disabled } = this.props; const { width, height } = this.mediaDimensions; const pixelCrop = convertToPixelCrop(crop, width, height); @@ -637,8 +637,7 @@ class ReactCrop extends PureComponent { ref={this.bindCropSelectionRef} style={style} className="ReactCrop__crop-selection" - onMouseDown={this.onCropMouseTouchDown} - onTouchStart={this.onCropMouseTouchDown} + onPointerDown={this.onCropPointerDown} > {!disabled && !locked && (
diff --git a/package.json b/package.json index 406b7aa..66838a0 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "react-image-crop", - "version": "8.6.11", + "version": "8.6.12", "description": "A responsive image cropping tool for React", "repository": "https://github.com/DominicTobias/react-image-crop", "main": "dist/ReactCrop.min.js",