-
Notifications
You must be signed in to change notification settings - Fork 6
Animate removed item out of the list #10
Comments
Sounds good! I think this is something that many need and is naturally expected to happen. It probably boils down to how an element can be animated when it is no longer rendered (= removed from DOM) In React I would normally animate it first and then have it removed from DOM when the animation is finished with |
Lol I was just about request the same 😂 |
Here's a simple example of how to achieve this with current API https://codesandbox.io/s/list-shuffling-flip-2-iuqdr?file=/src/App.js If an item is removed, other items already smoothly move in to fill the space. However, there are a couple of shortcomings:
So it would be ideal to fix these two. |
I'll be perfectly up-front: I don't think I'll be able to get to this as quickly as I'd hoped when I opened this case. If you want to close this issue, I won't be remotely offended. Fingers crossed some other braze soul is up for the challenge :) |
@arackaf It's OK. I will try to come up with something over the weekend. |
So, initially I was going to come up with some quick solution, but now I think there's room for a bigger refactor. Manipulating transitions from JS is a pain and more complex functionality will probably lead to more hacks which I want to avoid. However, I noticed that (apart from some reported bugs) Web Animations API is enabled in all modern browsers now. I think I am going to do a rewrite that uses the |
@jlkiri that sounds amazing man! |
It's now possible in |
Oh damn - nice!!! |
Hi - wonderful library. From what I can tell it doesn't seem possible to set an animation for an item that's being removed from a list - is that true? For example, in your planets demo, if I wanted to remove Pluto, have it fly off to the left as the other planets move in to fill the space.
Would that be a feature you'd be interested in? I'd love to give it a shot if you think it's a good idea.
The text was updated successfully, but these errors were encountered: