Gestures are single or multi-touch pointer events with defined behaviors. A touchable component defines an array of gesture handlers.

During a touch interaction, when the user performs an action that maps to a defined gesture, Alexa cancels the current touch interaction (onCancel) and passes control to the applicable gesture handler. The gesture handler takes over all touch interaction until the user completes or releases the gesture.

For example, the user touches a TouchWrapper and releases it. This doesn't correspond to any gestures. Therefore, the onDown and onUp handlers on the TouchWrapper run.

In contrast, the user touches and holds the TouchWrapper, which corresponds to a LongPress gesture. When the TouchWrapper has a LongPress gesture handler, that handler takes over and the onUp and onPress handlers on the TouchWrapper don't run. When the TouchWrapper doesn't have a LongPress gesture handler defined, normal onUp and onPress handlers run.

The type field for a gesture handle identifies the type of gesture. You can define handlers for the following gestures:

Was this page helpful?

Last updated: Nov 28, 2023