Skip to content

Commit 6c433d5

Browse files
committed
fix: recalculate rowHeight() when isVirualized
When rendering rows with isVirualized, if rowHeight is a func, the virtualized list was not recalculating the rowHeight. Per the `react-virtualized` docs [here](https://github.com/bvaughn/react-virtualized/blob/master/docs/Lis t.md#recomputerowheights-index-number), `List.recomputeRowHeights()` needs to be called. This only fixes the dynamic rowHeight issue _after_ dragging a node is finished. An additional `List.recomputeRowHeights()` will need to be called to fix the ‘preview’ while dragging a row (see issue below for more details). This partially fixes [Issue 264](#264).
1 parent 7c842aa commit 6c433d5

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/react-sortable-tree.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,8 @@ class ReactSortableTree extends Component {
235235
getNodeKey: this.props.getNodeKey,
236236
});
237237

238+
this.scrollZoneVirtualListComponent.wrappedInstance.recomputeRowHeights();
239+
238240
this.props.onChange(treeData);
239241

240242
this.props.onMoveNode({
@@ -634,6 +636,9 @@ class ReactSortableTree extends Component {
634636
{({ height, width }) => (
635637
<ScrollZoneVirtualList
636638
{...scrollToInfo}
639+
ref={el => {
640+
this.scrollZoneVirtualListComponent = el
641+
}}
637642
verticalStrength={this.vStrength}
638643
horizontalStrength={this.hStrength}
639644
speed={30}

0 commit comments

Comments
 (0)