useOnLongPress
About
A hook to detect long press on an element.
Examples
Basic example
Custom duration and touch end behavior
Arguments
Argument value | Type | Description | Defualt |
---|---|---|---|
callback | Function | Callback function to be called when long press is detected | undefined |
options | Object | See table below | undefined |
Options value | Type | Description | Default |
---|---|---|---|
duration | Number | The duration (in ms) after which long press is detected | 300 |
onClick | Function | Fires on click | undefined |
Returns
Return value | Type | Description | Defualt |
---|---|---|---|
ref | Callback Ref | A ref that can be used on the element you want to detect long press on | undefined |