Hook to handle long press interactions.
The element type.
The function to call when a long press is detected.
Configuration options (delay, preventDefault).
Event handlers for onPointerDown and onPointerUp.
onPointerDown
onPointerUp
Triggers the callback after a specified delay while the pointer is held down. Can optionally prevent the default behavior of the pointerup event.
pointerup
const { onPointerDown, onPointerUp } = useLongPress(() => { console.log("Long pressed!");});return <button onPointerDown={onPointerDown} onPointerUp={onPointerUp}>Press Me</button>; Copy
const { onPointerDown, onPointerUp } = useLongPress(() => { console.log("Long pressed!");});return <button onPointerDown={onPointerDown} onPointerUp={onPointerUp}>Press Me</button>;
Hook to handle long press interactions.