From 7e4dd2374cb83f72168e0b2fc416fa76dd6fbe6e Mon Sep 17 00:00:00 2001 From: Taya Leutina Date: Thu, 11 Jul 2024 12:11:41 +0300 Subject: [PATCH] fix(Sheet): fix incorrect content height calculation (#1700) --- src/components/Sheet/SheetContent.tsx | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/components/Sheet/SheetContent.tsx b/src/components/Sheet/SheetContent.tsx index 63e549acc8..0f3cdf62b8 100644 --- a/src/components/Sheet/SheetContent.tsx +++ b/src/components/Sheet/SheetContent.tsx @@ -93,7 +93,7 @@ class SheetContent extends React.Component { + private getAvailableContentHeight = (sheetHeight: number) => { const availableViewportHeight = window.innerHeight * MAX_CONTENT_HEIGHT_FROM_VIEWPORT_COEFFICIENT - this.sheetTopHeight; - const resultHeight = + const availableContentHeight = sheetHeight >= availableViewportHeight ? availableViewportHeight : sheetHeight; - return resultHeight; + return availableContentHeight; }; private show = () => { @@ -435,22 +435,22 @@ class SheetContent extends React.Component sheetHeight + this.state.prevSheetHeight > sheetContentHeight ? `height 0s ease ${TRANSITION_DURATION}` : 'none'; - this.sheetContentRef.current.style.height = `${resultHeight - this.sheetTopHeight}px`; - this.sheetRef.current.style.transform = `translate3d(0, -${resultHeight}px, 0)`; - this.setState({prevSheetHeight: sheetHeight, inWindowResizeScope: false}); + this.sheetContentRef.current.style.height = `${availableContentHeight}px`; + this.sheetRef.current.style.transform = `translate3d(0, -${availableContentHeight + this.sheetTopHeight}px, 0)`; + this.setState({prevSheetHeight: sheetContentHeight, inWindowResizeScope: false}); }; private addListeners() {