Releases: sekoyo/react-image-crop
3.0.9
3.0.8
3.0.7
3.0.6
3.0.5
3.0.4
3.0.3
3.0.2
3.0.1
3.0.0
-
You must always implement
onChange
and update the crop state, ReactCrop no longer maintains the crop in it's own state. This is in an effort to make the component more pure and predictable. -
Due to this change if you specify an
aspect
you can either omitwidth
andheight
, or you must specify both. This is because the crop object is now an immutable prop and ReactCrop can't fill it in for you. If you don't know the ratio of the image you should set the crop from insideonImageLoaded
:
import ReactCrop, { makeAspectCrop } from 'react-image-crop';
onImageLoaded = (image) => {
this.setState({
crop: makeAspectCrop({
x: 0,
y: 0,
aspect: 16 / 9,
width: 50,
}, image.width / image.height),
});
}
-
onImageLoaded
only passes the image element as the first parameter. -
A copy of the image is no longer rendered, increasing performance particularly in the case of a base64 image.
-
keepSelection
will not remove the crop even when dragging outside the crop (not just clicking). It also won't hide the resize handles whilst clicking down outside the crop which was causing a flickering effect. -
ReactCrop--new-crop
class changed toReactCrop--active
and on if resizing a crop too. -
Fixed crop continuing to expand when resizing movement goes outside the image bounds