UNPKG

@mirawision/reactive-hooks

Version:

A comprehensive collection of 50+ React hooks for state management, UI interactions, device APIs, async operations, drag & drop, audio/speech, and more. Full TypeScript support with SSR safety.

28 lines (27 loc) 970 B
export interface LongPressOptions { delay?: number; cancelOnMove?: boolean; } export interface LongPressHandlers { onMouseDown: (e: React.MouseEvent) => void; onMouseUp: (e: React.MouseEvent) => void; onMouseLeave: (e: React.MouseEvent) => void; onTouchStart: (e: React.TouchEvent) => void; onTouchEnd: (e: React.TouchEvent) => void; onTouchMove: (e: React.TouchEvent) => void; } /** * A hook that detects long press events for both mouse and touch interactions. * @param handler Callback to execute on long press * @param opts Configuration options * @returns Object with event handlers to attach to element * * @example * const handlers = useLongPress(() => console.log('long press!'), { * delay: 500, * cancelOnMove: true * }); * * return <button {...handlers}>Press and hold</button>; */ export declare function useLongPress(handler: (e: MouseEvent | TouchEvent) => void, opts?: LongPressOptions): LongPressHandlers;