diff --git a/src/context.ts b/src/context.ts index 4f8742c..6678d64 100644 --- a/src/context.ts +++ b/src/context.ts @@ -16,6 +16,7 @@ interface DrawerContextValue { keyboardIsOpen: React.MutableRefObject; snapPointsOffset: number[] | null; snapPoints?: (number | string)[] | null; + activeSnapPointIndex?: number; modal: boolean; shouldFade: boolean; activeSnapPoint?: number | string | null; diff --git a/src/index.tsx b/src/index.tsx index 99179b6..e128e90 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -769,6 +769,7 @@ export function Root({ keyboardIsOpen, modal, snapPointsOffset, + activeSnapPointIndex, direction, shouldScaleBackground, setBackgroundColorOnScale, @@ -824,6 +825,7 @@ export const Content = React.forwardRef(function ( onDrag, keyboardIsOpen, snapPointsOffset, + activeSnapPointIndex, modal, isOpen, direction, @@ -891,7 +893,7 @@ export const Content = React.forwardRef(function ( style={ snapPointsOffset && snapPointsOffset.length > 0 ? ({ - '--snap-point-height': `${snapPointsOffset[0]!}px`, + '--snap-point-height': `${snapPointsOffset[activeSnapPointIndex ?? 0]!}px`, ...style, } as React.CSSProperties) : style