diff --git a/src/sheet.tsx b/src/sheet.tsx index 32557eb..50cc2e5 100644 --- a/src/sheet.tsx +++ b/src/sheet.tsx @@ -26,6 +26,7 @@ import { } from './constants'; import { ExposedSheetContext, InternalSheetContext } from './context'; import { useDimensions } from './hooks/use-dimensions'; +import { useIsomorphicLayoutEffect } from './hooks/use-isomorphic-layout-effect'; import { useKeyboardAvoidance } from './hooks/use-keyboard-avoidance'; import { useModalEffect } from './hooks/use-modal-effect'; import { usePreventScroll } from './hooks/use-prevent-scroll'; @@ -320,6 +321,12 @@ export const Sheet = forwardRef( }, }); + useIsomorphicLayoutEffect(() => { + if (state === 'opening') { + y.set(closedY); + } + }, [state, closedY, y]); + const dragProps: InternalContextType['dragProps'] = { drag: 'y', dragElastic: 0,