Skip to content

Commit 9d31829

Browse files
committed
fix drag animation for react 18
1 parent 20e94d5 commit 9d31829

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

src/DockDropLayer.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ export class DockDropSquare extends React.PureComponent<DockDropSquareProps, Doc
3838
targetElement = targetElement.parentElement;
3939
}
4040
if (panelData.group === placeHolderStyle && direction !== 'float') {
41-
// place holder panel should always have full size drop rect
41+
// placeholder panel should always have full size drop rect
4242
this.context.setDropRect(targetElement, 'middle', this, e);
4343
} else {
4444
let dockId = this.context.getDockId();

src/DockLayout.tsx

+6-3
Original file line numberDiff line numberDiff line change
@@ -411,9 +411,12 @@ export class DockLayout extends DockPortalManager implements DockContext {
411411
let {dropRect} = this.state;
412412
if (dropRect) {
413413
if (direction === 'remove') {
414-
if (dropRect.source === source) {
415-
this.setState({dropRect: null});
416-
}
414+
this.setState((oldStates) => {
415+
if (oldStates.dropRect.source === source) {
416+
return {dropRect: null};
417+
}
418+
return {};
419+
});
417420
return;
418421
} else if (dropRect.element === element && dropRect.direction === direction && direction !== 'float') {
419422
// skip duplicated update except for float dragging

0 commit comments

Comments
 (0)