reactjsreact-bootstrapreact-virtualized

Using collapsible panels within react-virtualized List


I've managed to render a react-virtulized List to which I passed an array of react-bootstrap Panels. I've measured each of my rows, and via children callback, each time one of the child panels are clicked, an attribute in the parent state is updated. Said attribute is used inside the react-virtualized List rowHeight() function top check whether that panel is currently expanded. Then, using a ref to my List, i call the recomputeRowHeights(index) and forceUpdateGrid() methods on saidref.

The thing is, while the List component correctly updates both the height and position of my rows, the animation isn't smooth. I mean, the bootstrap expand animation works fine, but the change in height of the expanded row happens instantly after the click event, and then the animation starts, feeling somewhat chopy.

Is there any workaround for this, or is this an upcoming/planned/in the works feature for react-virtualized?


Solution

  • Unfortunately, I have not spent much time working with or optimizing for resize animations within react-virtualized. It doesn't surprise me to hear that the resize/reposition is a bit choppy in the case you mention.

    Here's a quick-and-dirty example of one way you may add animation:

    plnkr.co/edit/VanCAQmSkUejp3hbJUyJ?p=preview