react-image-crop icon indicating copy to clipboard operation
react-image-crop copied to clipboard

The previous image layout still be kept after switch image

Open daFoggo opened this issue 1 year ago • 1 comments

Hi. I'm currently having this issues. Can someone help me please? https://github.com/sekoyo/react-image-crop/assets/108665939/7fa65ecb-112a-435a-939f-74d7bfb60707

daFoggo avatar Mar 30 '24 02:03 daFoggo

@daFoggo Hello! As a workaround, you can add unique key to ReactCrop component, so it will rerender every time your image updates.

<ReactCrop
  key={uniqueImageKey}
  circularCrop
  keepSelection
  crop={crop}
  aspect={1}
  minWidth={50}
  onChange={(_, percentCrop) => setCrop(percentCrop)}
  onComplete={(c) => setCompletedCrop(c)}
>
   {/* Your image */}
</ReactCrop>

Possibly the problem is with rect in svg def. It has width and height 100% and it doesn't update visually when image dimensions are changed.

bodryi avatar Jul 02 '24 13:07 bodryi