orElse
Each in turn: a gesture waits for the ones before it to fail, so
orElse(tap({ count: 2 }), tap()) is a double tap, or else a tap. (Not
then: a module exporting then is a thenable, which import() calls.)
Usage
Prefer a long press and fall back to a tap.
// Prefer a long press and fall back to a tap.
import { Box, longPress, orElse, tap } from 'kuito';
export function PreviewCard() {
const preview = longPress({ onStart: () => console.log('Preview') });
const open = tap({
onEnd: (_event, success) => {
if (success) console.log('Open');
},
});
return (
<Box gestures={[orElse(preview, open)]} width={160} height={100} backgroundColor="#cbd5e1" />
);
}Signatures
(...gestures: Composable[]): ComposedGestureParameters
| Name | Type | Required | Description |
|---|---|---|---|
...gestures | Composable[] | Yes | — |
Returns
Generated from the public TypeScript declarations: signatures, props and defaults come from the checked source, descriptions from its JSDoc. No defaults are invented.