Tap Gesture
The Tap
gesture detects a deliberate tap on a component, in a manner that is more restrictive than onPress
. Tap
imposes the following additional restrictions with respect to the initial down and final pointer up events:
- They must occur within a short distance, to rule out drag-like gestures.
- They must describe a vector of little or no velocity, to rule out swipe-like gestures.
Properties
Property | Type | Default | Description |
---|---|---|---|
|
"Tap" |
REQUIRED |
Describes the type of gesture |
|
Array of commands |
|
Commands to run when a tap occurs |
onTap
Commands to run when a Tap
event is detected. This event can occur after the pointer has been released. These commands are executed after the onCancel
event handler has executed.
The event generated has the following form.
"event": {
"source": {
"type": COMPONENT_TYPE, // The type of the component
"handler": "Tap",
... // Component source properties
},
"component": {
"x": Number, // X-position of the up event in the component (dp)
"y": Number, // Y-position of the up event in the component (dp)
"width": Number, // Width of the component in dp
"height": Number, // Height of the component in dp
},
"inBounds": Boolean // True if the pointer is within the components transformed bounds
}
The inBounds
calculation for the pointer position doesn't consider overlapping components.
Refer to Event source for a description of event.source
properties.
The onTap
handler executes in normal mode.
Event sequence for the Tap gesture
A Tap
gesture triggers the following event handlers:
The maximum velocity and maximum travel that qualify a touch as a Tap
are defined by the runtime operating system.
Last updated: Nov 28, 2023