-
-
Notifications
You must be signed in to change notification settings - Fork 170
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
Default cropsize is {width: 0, height: 0}
#267
Comments
This is a classic issue of showing an element that needs to know it's side in a modal: you should only instantiate it when the modal is open. You can add a condition to only render the cropper once the modal is open. |
Thanks so much for your response! Sorry that it might have been a dumb question! Condition added and it works great - I wish you the best of luck with the future of this package! |
There is no dumb question! Thanks for the kind words. |
Hi, I'm having the same problem, how do I wait for the modal to show? |
It depends on what modal you use. If you provide an example on CodeSandbox, I can help you 😉 |
Here's a fixed version: https://codesandbox.io/s/basic-antd-4-17-3-forked-wxf4b?file=/index.js There were a few things to do:
|
Thank you |
I happened to have this problem, thanks a lot! |
I'm actually planning to try using a |
Describe the bug
Hello! I think maybe I found a bug? I have been messing with this for a few hours and am stumped... The first time I used this inside a modal it worked great! This time, I am using it inside a modal with a collapse and am getting a default
cropSize
of{width: 0, height: 0}
-- I have checked the docs a ton and read through the issues but can't seem to find one that matches what I am experiencing.Either way - I am loving the package and hope that this is just me missing something crazy obvious - I have tried to set the default crop size manually - but that makes it so the image does not get centered by default.
I have attached a quick video to show my problem... and some code below.
Funny part is, if I resize the window, it recalculates the cropSize and it works.
I have also forced this not to load unless the image is loaded, without luck.
Thanks for the help!
Quick Video of Problem:
https://user-images.githubusercontent.com/62756900/122150245-f59f4d80-ce22-11eb-935f-e12c75b1fc46.mp4
The text was updated successfully, but these errors were encountered: