[Q] About animating and dynamically growing items
See original GitHub issueFirst thanks for the great work on that library!
I was asking myself a question about items animation. I have been using react-virtualized
so far, but it also applies to react-window
.
The current positioning strategy is to use absolute offset based on scroll position, right? Which makes it difficult to use CSS techniques to animate items. JS techniques are also problematic if they involve re-rendering the whole list each frame.
Do you have a suggestion on the best way to implement this? Typically, think about a contact card in a contact list, that can be expanded with more info.
Do you think static positioning would work? For example, by adding a transparent div the size of the items prepending the windowed items? (yes I mean me developing another custom solution for my specific purpose, but I wanted to ask the question as you explored this a lot more and migh see the obvious issues with this strategy 😃)
Issue Analytics
- State:
- Created 5 years ago
- Comments:14 (2 by maintainers)
Top GitHub Comments
Here’s a Code Sandbox that shows how to use CSS transitions to animate size and position of items within a react-window list: https://codesandbox.io/s/n753oo58vj
It might work. I tried this approach a long time ago with react-virtualized and I don’t remember what specifically about it was less appealing. All I can say is that the current approach– either absolutely positioning or using e.g.
translate
is the easiest to implement and performs well. (Performance is my primary concern with a lib like this.)I’ve looked for a way to animate list items within react-window and found this thread. Can anyone explain to me why I can get #1 sandbox to animate using CSS transition but not #2 sandbox?
#1 https://codesandbox.io/s/react-window-animated-item-resize-szgdf?file=/src/Demo.js:1085-1087
#2 https://codesandbox.io/s/bvaughnreact-window-variable-size-list-vertical-qwm53?file=/index.js
Thanks in advance 🤞