Resizing rows in dynamic list
See original GitHub issueI’ve given the dynamic list of this great lib a spin and encountered two issues:
- My rows can expand/collapse on click (i.e. change height), but the virtualized list doesn’t adapt the item positions. Could this benefit from a 
ResizeObserverhook such as useMeasure? - It would be very nice to have a mechanism where the dynamic list’s overall initial height is set such that it doesn’t cut off partial rows. See e.g. the first example shown in react-collapse where the height limit is set by the number of visible paragraphs.
 
Issue Analytics
- State:
 - Created 3 years ago
 - Reactions:20
 - Comments:10
 
Top Results From Across the Web
Resizing rows in dynamic list · Issue #28 · TanStack/virtual
My rows can expand/collapse on click (i.e. change height), but the virtualized list doesn't adapt the item positions. Could this benefit from a...
Read more >Resizing ListView Rows Dynamically - android - Stack Overflow
Overview: I have a ListView of different types of rows including images and text of varying heights. At runtime, I am trying to...
Read more >How to change and AutoFit row height in Excel - Ablebits
Here's how: To change the height of one row, drag the lower boundary of the row heading until the row is set to...
Read more >Resize a table by adding or removing rows and columns
You can use the Resize command in Excel to add rows and columns to a table: Click anywhere in the table, and the...
Read more >Dynamic resize - Templater
Dynamic resize. Templater's low level API has the Resize(int) method which is used to (usually vertically) resize on object.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Yes, using
ResizeObserveris the way to go. Current it’s possible to implement this with small row wrapper, checkout demo at https://codesandbox.io/s/resizeobserver-react-virtual-6131c?file=/src/index.jsIMHO as ResizeObserver is supported in every modern browser https://caniuse.com/resizeobserver maybe we can officially supporting it.
I’ve found that for any dynamic size to be able to work we shouldn’t set a fixed
heighton the row elements I also have content that allows to expand an item and it doesn’t work unless I substituteheightformin-heightFor example my inner content would expand an item from 100px to 350px, but it won’t work when the row has a fixed height of 100px When I use
min-heightthe row is allowed to expand, which in turn gets captured bymeasureRefand the change propagates tovirtualRow.sizeandvirtualRow.startI imagine to be able to both expand and shrink we should not be setting any height at all, but only
measureRef