Skip to content
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

[v2.1.0] react-cropper not rendering when ref not passed #267

Closed
duc-gp opened this issue Aug 21, 2020 · 7 comments
Closed

[v2.1.0] react-cropper not rendering when ref not passed #267

duc-gp opened this issue Aug 21, 2020 · 7 comments
Labels

Comments

@duc-gp
Copy link

duc-gp commented Aug 21, 2020

Hi again,

I just tried out the new version and somehow something seems not to work as expected anymore with the src prop

here its working version: 2.0.0:
https://codesandbox.io/s/cropper-second-bug-working-bcqp5?file=/src/App.js

here same code not working 2.1.0:
https://codesandbox.io/s/cropper-second-bug-not-working-seu0e

code is the same, only difference is version number

@duc-gp duc-gp added the bug label Aug 21, 2020
@shekhar-shubhendu
Copy link
Collaborator

this is not a bug. you need to provide a ref now and react-cropper is not creating one for you if you are not passing it.
https://codesandbox.io/s/cropper-second-bug-not-working-forked-jsqly

@shekhar-shubhendu shekhar-shubhendu changed the title base64 img not working anymore with 2.1.0 [v2.1.0] react-cropper not rendering when ref not passed Aug 22, 2020
@duc-gp
Copy link
Author

duc-gp commented Aug 22, 2020

oh, okay thank you!

@shekhar-shubhendu
Copy link
Collaborator

I'll add a fix for this too. and add a test using base64 image.

@duc-gp
Copy link
Author

duc-gp commented Aug 24, 2020

thats great, thanks!

@duc-gp
Copy link
Author

duc-gp commented Aug 25, 2020

I checked out your codesandbox and just wanted to test but am confused now. In your example you just created a ref and passed it to the cropper component, but how would I get the instance now?

we have the following in our codebase, this code worked in version 1.3

ref={ref => {
    this.cropper = ref;
}}

but with version 2.1.0 and this code we get The first argument is required and must be an <img> or <canvas> element.

@shekhar-shubhendu
Copy link
Collaborator

I think I fixed this too in V2.1.1-0

@duc-gp
Copy link
Author

duc-gp commented Aug 26, 2020

alright thanks, ill check it out onced its released

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants