Callbacks
Long press lifecycle callbacks
Structure
All callbacks (including main callback function) has the same structure.
callbackFn(event, meta): voidtype LongPressCallback<Target extends Element = Element, Context = unknown> = (
event: LongPressEvent<Target>,
meta: LongPressCallbackMeta<Context>
) => voidAs a first argument callback receives React event from a proper handler (e.g. onMouseDown) and as second receives meta object with following structure:
Pseudocode
{ [context: any], [reason: string] }export type LongPressCallbackMeta<Context = unknown> = {
context?: Context;
reason?: LongPressCallbackReason
};Both object properties are optional.
Context
context will be present if you pass it to bind function. See context for more info.
Reason
reason will be present in onCancel callback to indicate why long press was cancelled.
Here is a list of all possible reason values
Press startedOn movePress finishedLong press cancelledLast updated
Was this helpful?