Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(Sheet): remove animation lags when closing in some browsers #1984

Merged
merged 2 commits into from
Dec 11, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 7 additions & 10 deletions src/components/Sheet/SheetContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const ACCELERATION_Y_MAX = 0.08;
const ACCELERATION_Y_MIN = -0.02;
// 90% from viewport
const MAX_CONTENT_HEIGHT_FROM_VIEWPORT_COEFFICIENT = 0.9;
const WINDOW_RESIZE_TIMEOUT = 25;
const WINDOW_RESIZE_TIMEOUT = 50;

let hashHistory: string[] = [];

Expand Down Expand Up @@ -123,21 +123,14 @@ class SheetContent extends React.Component<SheetContentInnerProps, SheetContentS
render() {
const {content, contentClassName, swipeAreaClassName, hideTopBar, title} = this.props;

const {
deltaY,
swipeAreaTouched,
contentTouched,
veilTouched,
isAnimating,
inWindowResizeScope,
} = this.state;
const {deltaY, swipeAreaTouched, contentTouched, veilTouched, isAnimating} = this.state;

const veilTransitionMod = {
'with-transition': !deltaY || veilTouched,
};

const sheetTransitionMod = {
'with-transition': !inWindowResizeScope && veilTransitionMod['with-transition'],
'with-transition': veilTransitionMod['with-transition'],
};

const contentMod = {
Expand Down Expand Up @@ -416,6 +409,10 @@ class SheetContent extends React.Component<SheetContentInnerProps, SheetContentS
};

private onResizeWindow = () => {
if (this.state.isAnimating) {
return;
}

this.setState({inWindowResizeScope: true});

if (this.resizeWindowTimer) {
Expand Down
Loading