Skip to main content
Use gestureDetector for native gesture recognition. It supports tap, pan, and longPress. drag is available as a pan alias when that better describes the interaction.

Tap

Pan with a shared value

Use mapEvent when the callback only copies event fields into shared values. Use event or a normal callback when custom logic is needed.

Long press

Gesture event data

Gesture events can include state, x, y, absoluteX, absoluteY, translationX, translationY, velocityX, velocityY, pointerCount, and timestamp. Lifecycle callbacks are onBegin, onStart, onUpdate, onEnd, onCancel, and onFinalize. onUpdate is continuous; use it sparingly and prefer mapEvent for direct animation updates.

Best practices

  • Keep gesture callbacks small and move visual updates into shared values.
  • Use minDistance to prevent accidental pans from taps.
  • Reset or settle shared values in onEnd, onCancel, or onFinalize.
  • Do not perform network requests directly on every onUpdate event.
  • Test gestures on a real device because native touch arbitration affects final behavior.