-
Notifications
You must be signed in to change notification settings - Fork 155
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
beforeCrop property problem #274
Comments
yes, the logic has changed, |
because of this I get a situation where I can’t prohibit files at the img-crop stage beforeCrop - I check that the file is acceptable for img-crop. The file is invalid but calls beforeUpload, although upload is prohibited... in beforeUpload I also do a protection check, and I get a double check and a double error message.. |
yes, this may require check twice. for your scene, I think this can be done: const canUpload = useRef(false)
const beforeCrop = (file) => {
// do check
}
beforeCrop={(file) => {
canUpload.current = beforeCrop(file)
return canUpload.current
}}
beforeUpload={() => canUpload.current} |
Yes, there are options to handle the case. It was great before this) Perhaps all situations would be resolved if beforeCrop returned an enum value that either completely stopped or skipped the crop stage enum.SKIP |
thx, will consider that. |
Codesandbox https://codesandbox.io/p/sandbox/antd-img-crop-beforecrop-problem-wftx6c
Open console
Upload a file larger than 2 MB
Called beforeUpload
It is expected that beforeUpload will not be called. This behavior was present in earlier versions of antd-img-crop
The text was updated successfully, but these errors were encountered: