Introduction
About long press hook
Last updated
About long press hook
Last updated
React hook for detecting click / tap / point and hold event
Mouse, Touch and Pointer events support
Pass custom context and access it in callback
Cancel long press if moved too far from the target
Flexible callbacks: onStart, onMove
, onFinish
, onCancel
Disable hook when necessary
Filter undesired events (like mouse right clicks)
Handle long press on single React component
Handle long press on multiple React components (e.g. list of elements where you can provide element id as hook context to distinguish which element triggered long press). For more info see context.
Handle custom long press (you can manually attach different handlers to different React components). For more info see handlers.
It does not prevent browser specific behaviour on long press. Most of them can be handled using CSS.