import { createContext, useContext } from 'react'; import type { MutableRefObject } from 'react'; interface DragableDrawerContextValue { /** Whether the drawer has settled at maximum height (offset === 0). */ isAtMaxHeight: boolean; /** Current vertical scroll offset reported by DragableScrollView. */ scrollYRef: MutableRefObject; /** Report scroll offset changes from DragableScrollView. */ onScrollY: (y: number) => void; /** Begin a drawer pan gesture (stops any running animation). */ beginPan: () => void; /** Move the drawer by dy pixels during an active pan. */ movePan: (dy: number) => void; /** End pan and snap to the nearest snap point. */ releasePan: (dy: number, vy: number) => void; } const noop = () => ({}); const DragableDrawerContext = createContext({ isAtMaxHeight: false, scrollYRef: { current: 0 }, onScrollY: noop, beginPan: noop, movePan: noop, releasePan: noop, }); export const useDragableDrawerContext = () => useContext(DragableDrawerContext); export default DragableDrawerContext;