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

It does not change its image #18

Closed
cesarpe opened this issue Mar 2, 2019 · 2 comments
Closed

It does not change its image #18

cesarpe opened this issue Mar 2, 2019 · 2 comments

Comments

@cesarpe
Copy link

cesarpe commented Mar 2, 2019

Hello,
When I do this, it works
<Zoom
   img = {this.state.imgcur}
   zoomScale = {3}
   height = {450}
   width = {400}
   transitionTime = {0.5}
   />
but when I change the image with this.setState ({imgcur: newImage}), it does not refresh

@cesarpe
Copy link
Author

cesarpe commented Mar 2, 2019

I solved it by adding a value to the key
<Zoom key = {this.state.key}
   img = {this.state.imgcur}
   zoomScale = {3}
   height = {450}
   width = {400}
   transitionTime = {0.5}
   />
Change the index and the new image, to update the 2 values
this.setState ({imgcur: newImage, key: index}),

Thanks for the code

@LeoNero
Copy link
Owner

LeoNero commented Mar 8, 2019

Hi @cesarpe ! Glad you were able to solve it.

Also, I will create another issue so that I can remember to see if there is another solution :)

@LeoNero LeoNero closed this as completed Mar 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants