import type { GestureResponderHandlers, LayoutChangeEvent, View, ViewStyle } from 'react-native'; import type { DragAxis, DragGestureCallback } from './types'; export interface UseDragGestureOptions { /** Turn the whole gesture off (disabled / read-only controls). Default true. */ enabled?: boolean; /** Directions the surface consumes. Drives `touch-action` on web. Default `both`. */ axis?: DragAxis; /** * Claim the gesture the moment the surface is touched, so a tap commits a * value and the drag is already ours before the browser or a parent * ScrollView can consider the touch a scroll. Default true. */ claimOnStart?: boolean; /** * Travel (px) required before a *move* claims the gesture. Only consulted * when `claimOnStart` is false — controls that must let a tap fall through to * something else (a text field that also drag-scrubs) set this. */ activationDistance?: number; /** Claim in the capture phase, outranking any child responders. Default false. */ capture?: boolean; /** Hold the web page-scroll lock while dragging. Default true. */ lockPageScroll?: boolean; /** Hold the web text-selection lock while dragging. Default true. */ lockTextSelection?: boolean; /** Web cursor for the idle surface. */ cursor?: string; /** Web cursor while a drag is in flight. Defaults to `cursor`. */ activeCursor?: string; /** Fired once when the gesture is granted, with the press location. */ onStart?: DragGestureCallback; /** Fired for every pointer sample while the gesture is held. */ onMove?: DragGestureCallback; /** Fired once when the pointer is released. */ onEnd?: DragGestureCallback; /** Fired instead of `onEnd` when the gesture is terminated (backgrounded, torn down). */ onCancel?: () => void; } export interface UseDragGestureResult { /** Spread onto the View that owns the gesture. */ panHandlers: GestureResponderHandlers; /** Web-only style props (`touch-action`, selection, cursor) for that same View. */ surfaceStyle: ViewStyle; /** Attach to the same View — used to measure the surface's page origin. */ ref: React.MutableRefObject; /** Pass to the same View's `onLayout` (compose it if the caller needs its own). */ onLayout: (event: LayoutChangeEvent) => void; /** True between grant and release/terminate. */ isDragging: boolean; /** Latest known surface box, in page coordinates. */ getSurfaceRect: () => { x: number; y: number; width: number; height: number; }; } /** * The shared pan gesture used by every value control in the library * (Slider, Knob, Joystick, Rating, …). * * It exists because each of those had grown its own copy of the same four * concerns, each with slightly different bugs: * * 1. **Surface-relative coordinates.** `locationX/locationY` are relative to * whatever view the touch landed on, which during a drag is whichever child * happens to be under the finger — so they drift the moment a thumb slides * beneath the pointer. This hook measures the surface once per gesture and * derives every sample from `pageX/pageY`, which stays correct even when the * finger leaves the control entirely. * 2. **Not losing the gesture to a scroll.** See `getGestureSurfaceStyle` and * `GESTURE_RESPONDER_LOCK`: `touch-action` on web, termination-request and * native-responder blocking on iOS/Android. * 3. **Page-scroll and text-selection locks**, taken on grant and released on * every exit path including unmount. * 4. **Termination handling**, so a torn-down gesture cannot leave the page * locked or a control stuck in its dragging state. */ export declare const useDragGesture: (options?: UseDragGestureOptions) => UseDragGestureResult;