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

Re-animate on component update #11

Closed
marharyta opened this issue Jul 23, 2018 · 2 comments
Closed

Re-animate on component update #11

marharyta opened this issue Jul 23, 2018 · 2 comments

Comments

@marharyta
Copy link

marharyta commented Jul 23, 2018

Hey, @dielduarte !
This library is incredible!
Is there a way to re-animate the component when the component is re-rendered?
I have a list of map markers that I want to re-animate every time we change the markers on a page. See the example.

https://codesandbox.io/s/1vjm67ny87
Here I have them animated every time the page is reloaded, yet how to reload them every time the component is re-mounted? Such as in search where the component appear and disappear depending on a search output?

@dielduarte
Copy link
Owner

hey @marharyta !

First, thanks for opening a PR, I will take a look in your example and come back for you ASAP!

@dielduarte
Copy link
Owner

dielduarte commented Jul 23, 2018

hey @marharyta !!

I did a small example using your code as the base, that already works as you think!

Look: https://codesandbox.io/s/mo2w6x7p4y

What happened in your example, indeed the pins won't be updated because you use the key prop with a fixed value, because of that React with your diff algorithm know which components really need a rerender.

Look my example, I pass a dynamic key and force an update after 3 seconds to add a new location and then all pins are animated again like you look for! :)

I hope that this can help you, I'll close this issue but feel free to opening again.

Thanks!

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