Long press hook
  • Introduction
  • Installation
  • Basics
  • Advanced
    • Definition
    • Callback
    • Options
      • Configuration
        • Events detection
        • Long press threshold
      • React events
        • Persisting event
        • Filtering events
      • Callbacks
        • Press started
        • On move
        • Press finished
        • Long press cancelled
      • Cancellation
        • Cancel outside element
        • Cancel on movement
    • Hook result / Bind function
      • Context
      • Handlers
  • Examples
    • Advanced usage example
    • Live examples
      • Version 3
      • Version 2 (deprecated)
      • Version 1 (deprecated)
  • Migration
    • V1 to V2
    • V2 to V3
    • ⚠️V3.1+
    • Change log
  • Contributions
    • ❤️Donations
    • Pull requests policy
  • Architectural Decisions
    • V1 and V2 deprecation
    • Moving to new repository
Powered by GitBook
On this page

Was this helpful?

  1. Advanced
  2. Options
  3. Callbacks

Long press cancelled

When released press before threshold time elapsed or conditionally triggered cancellation

PreviousPress finishedNextCancellation

Last updated 1 year ago

Was this helpful?

Name

onCancel

Type

Javascript
(event, meta) => void
TypeScript
(
  event: 
  | ReactMouseEvent<Target>
  | ReactTouchEvent<Target>
  | ReactPointerEvent<Target>,
  meta: { context?: Context; reason?: LongPressCallbackReason }
) => void

Default value

undefined

Description

Called when press is released BEFORE time elapses, therefore before long press could occur.

This callback is usually called with reason inside meta param. For possible reason values see .

threshold
here