Skip to content
Draft
Show file tree
Hide file tree
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
8 changes: 8 additions & 0 deletions .changeset/eighty-walls-smile.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
'@alfalab/core-components-bottom-sheet': patch
'@alfalab/core-components': patch
---

##### BottomSheet

- Добавлена поддержка `safe-area-inset-top` в PWA standalone режиме.
10 changes: 9 additions & 1 deletion packages/bottom-sheet/src/component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -597,12 +597,20 @@ export const BottomSheet = forwardRef<HTMLDivElement, BottomSheetProps>(
const getSwipeStyles = (): CSSProperties =>
sheetOffset ? { transform: `translateY(${sheetOffset}px)` } : {};

const isPWA =
isClient() &&
typeof window.matchMedia === 'function' &&
window.matchMedia('(display-mode: standalone)').matches;

const safeAreaMaxHeight = `min(${lastMagneticArea}px, calc(100vh - env(safe-area-inset-top) - ${headerOffset}px))`;
const maxHeight = isPWA ? safeAreaMaxHeight : `${lastMagneticArea}px`;

const getHeightStyles = (): CSSProperties => ({
height:
!isFirstRender && (initialHeight === 'full' || magneticAreasProp)
? `${lastMagneticArea}px`
: 'unset',
maxHeight: isFirstRender ? 0 : `${lastMagneticArea}px`,
maxHeight: isFirstRender ? 0 : maxHeight,
marginBottom:
virtualKeyboard && visualViewportSize && windowHeight > visualViewportSize.height
? windowHeight - visualViewportSize.height - visualViewportSize.offsetTop
Expand Down
Loading