-
-
Notifications
You must be signed in to change notification settings - Fork 344
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mask is does'nt showing the first time #579
Comments
Ok i found the solution, i use the onLoad attribute on the image to set the crop values. It works ! |
@Djibdjib I'm facing the same issue even though I'm using the onLoad attribute. Do you mind sharing what exactly you did to fix it? |
@immanu10 Yeah of course ! const onImageLoad = () => {
setCrop({
unit: "%",
width: currentFile.crop.w || 50,
height: currentFile.crop.h || 50,
x: currentFile.crop.x || 25,
y: currentFile.crop.y || 25,
});
}; <ReactCrop
key={crop}
crop={crop}
onChange={(c, p) => onChangeCrop(c, p)}
className="inline-block rounded-lg"
keepSelection={true}
ruleOfThirds={true}
>
<img src={currentSrcImage} className="rounded-t-lg" onLoad={onImageLoad} />
</ReactCrop> |
Yes its in a modal, but I am rendering it with React.createPortal. |
In my case, the issue was resolved when I didn't provide initial values in the crop's useState. const [crop, setCrop] = useState(); |
THANK YOU!!! Both proposed solution found here worked for me
I ended up using option 2. FYI, if you need to specify a crop do it on imageLoad with setCrop({ ... }) That's how I'm doing it and I fixed the issue I was having. \o/ |
Hi and thx for this tool !
When i open the crop in a modal, the mask is not showed the first time. If i close the modal and re open, all is perfect...
Thx for your help.
The text was updated successfully, but these errors were encountered: