joshwcomeau / react-flip-move

Effortless animation between DOM changes (eg. list reordering) using the FLIP technique.
http://joshwcomeau.github.io/react-flip-move/examples
MIT License
4.08k stars 259 forks source link

How to use react-flip-move with react-window #247

Closed shunmian closed 4 years ago

shunmian commented 4 years ago

I'm trying to use react-window to lazily load list items for react-flip-move. But the animation of react-flip-move doesn't work.

Please see codeSandbox for the sample code:

It might be the issue that I use react-flip-move incorrectly but I cannot spot the problem.

tobilen commented 4 years ago

This is probably not something i can help you with, since it is about combining two (complex) libraries and as such not really a "react-flip-move" issue.

Anyway, heres my two cents: flip-move needs to be able to manipulate the DOM freely. But the way you're implementing it, the DOM is the result of the virtualization lib. Your virtualization layer needs to yield control of the render tree to your animation layer until the animation is done. Only then can it rerender without the items removed from the DOM. You might want to

You might also want to take a look at https://github.com/aholachek/react-flip-toolkit or https://github.com/react-spring/react-spring directly instead of "react-flip-move". It is really not built for use with virtualization.