diff --git a/src/context.ts b/src/context.ts index b08603a..3b9a410 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 7d78d7c..3b2b009 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -765,6 +765,7 @@ export function Root({ keyboardIsOpen, modal, snapPointsOffset, + activeSnapPointIndex, direction, shouldScaleBackground, setBackgroundColorOnScale, @@ -818,6 +819,7 @@ export const Content = React.forwardRef(function ( onDrag, keyboardIsOpen, snapPointsOffset, + activeSnapPointIndex, modal, isOpen, direction, @@ -885,7 +887,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