Skip to content

Commit 394ab8b

Browse files
committed
semi-fix: recalculate rowHeight() when dragging
1 parent 6c433d5 commit 394ab8b

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@
5757
"> 1%"
5858
],
5959
"dependencies": {
60+
"lodash.debounce": "^4.0.8",
6061
"lodash.isequal": "^4.4.0",
6162
"prop-types": "^15.6.1",
6263
"react-dnd": "2.5.4",

src/react-sortable-tree.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import React, { Component } from 'react';
22
import PropTypes from 'prop-types';
33
import { AutoSizer, List } from 'react-virtualized';
4-
import isEqual from 'lodash.isequal';
4+
import isEqual from 'lodash.isequal';
5+
import debounce from 'lodash.debounce';
56
import withScrolling, {
67
createVerticalStrength,
78
createHorizontalStrength,
@@ -117,6 +118,9 @@ class ReactSortableTree extends Component {
117118
this.endDrag = this.endDrag.bind(this);
118119
this.drop = this.drop.bind(this);
119120
this.handleDndMonitorChange = this.handleDndMonitorChange.bind(this);
121+
this.recomputeRowHeightsDebounced = debounce(() => {
122+
this.scrollZoneVirtualListComponent.wrappedInstance.recomputeRowHeights();
123+
}, 300);
120124
}
121125

122126
componentDidMount() {
@@ -390,6 +394,8 @@ class ReactSortableTree extends Component {
390394
searchFocusTreeIndex: null,
391395
dragging: true,
392396
});
397+
398+
this.recomputeRowHeightsDebounced();
393399
}
394400

395401
endDrag(dropResult) {

0 commit comments

Comments
 (0)