Skip to content

Commit

Permalink
fix: add delayed action
Browse files Browse the repository at this point in the history
  • Loading branch information
mournfulCoroner committed Dec 10, 2024
1 parent 498860f commit 889c471
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions src/components/Sheet/SheetContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ class SheetContent extends React.Component<SheetContentInnerProps, SheetContentS
resizeWindowTimer: number | null = null;

isResizing = false;
needHide = false;

textLog = '';

Expand All @@ -99,6 +100,8 @@ class SheetContent extends React.Component<SheetContentInnerProps, SheetContentS
componentDidMount() {
this.addListeners();
this.show();
this.needHide = false;
this.isResizing = false;

const initialHeight = this.getAvailableContentHeight(this.sheetContentHeight);

Expand Down Expand Up @@ -401,9 +404,10 @@ class SheetContent extends React.Component<SheetContentInnerProps, SheetContentS

private onVeilClick = () => {
this.textLog += `${this.isResizing} is resizing\n`;
// if(this.isResizing) {
// return;
// }
if (this.isResizing) {
this.needHide = true;
return;
}
this.setState({veilTouched: true});
this.hide();

Expand Down Expand Up @@ -462,7 +466,12 @@ class SheetContent extends React.Component<SheetContentInnerProps, SheetContentS

this.sheetScrollContainerRef.current.style.height = `${availableContentHeight}px`;
this.sheetRef.current.style.transform = `translate3d(0, -${availableContentHeight + this.sheetTopHeight}px, 0)`;
this.setState({prevSheetHeight: sheetContentHeight, inWindowResizeScope: false});
this.setState({prevSheetHeight: sheetContentHeight, inWindowResizeScope: false}, () => {
this.isResizing = false;
if (this.needHide) {
this.onVeilClick();
}
});
};

private addListeners() {
Expand Down

0 comments on commit 889c471

Please sign in to comment.