Composing Gestures

When two gestures could claim the same touch, you declare how they relate instead of juggling flags. Gesture.Exclusive(a, b) gives a priority: b may activate only after a has failed, which is how the demo in Pan, Tap and Fling Gestures told a double tap from a single one (and why its single tap arrived a moment late, once the second tap had failed to come). Gesture.Simultaneous(a, b) lets both run together, as pinch and rotation do on a photo. Gesture.Race(a, b) activates whichever recognizes first and cancels the other.

Gesture Handler 6,788 's ways of relating gestures
Composition Behavior Typical use
Exclusive(a, b) b waits for a to fail Double tap over single tap
Simultaneous(a, b) Both active at once Pinch plus rotate
Race(a, b) First to activate wins Long press or pan
a.requireExternalGestureToFail(b) Across detectors Row swipe inside a list
a.simultaneousWithExternalGesture(b) Across detectors Pan with a ScrollView

Composed gestures nest, as in Gesture.Race(pan, Gesture.Exclusive(double, single)).