Skip to content

Commit

Permalink
fix: translate on resize
Browse files Browse the repository at this point in the history
  • Loading branch information
mournfulCoroner committed Oct 18, 2023
1 parent 6bd7eb0 commit 66593c1
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/components/Sheet/SheetContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ class SheetContent extends React.Component<SheetContentInnerProps, SheetContentS
private onContentTransitionEnd = (e: React.TransitionEvent<HTMLDivElement>) => {
if (e.propertyName === 'height') {
if (this.sheetContentRef.current) {
this.sheetContentRef.current.style.transition = 'none';
// this.sheetContentRef.current.style.transition = 'none';
}
}
};
Expand All @@ -403,14 +403,15 @@ class SheetContent extends React.Component<SheetContentInnerProps, SheetContentS
const contentHeight = this.sheetTitleHeight + this.innerContentHeight;

const viewportHeight = window.innerHeight;
const resultFullHeight =
const resultHeight =
contentHeight >= viewportHeight
? viewportHeight * MAX_CONTENT_HEIGHT_FROM_VIEWPORT_COEFFICIENT
: contentHeight;
const resultContentHeight = resultFullHeight - this.sheetTopHeight;

this.sheetContentRef.current.style.height = `${resultContentHeight}px`;
this.sheetRef.current.style.transform = `translate3d(0, -${resultFullHeight}px, 0)`;
this.sheetContentRef.current.style.height = `${resultHeight}px`;
this.sheetRef.current.style.transform = `translate3d(0, -${
resultHeight + this.sheetTopHeight
}px, 0)`;
};

private addListeners() {
Expand Down

0 comments on commit 66593c1

Please sign in to comment.