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.)
Verwendung
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" />
);
}Signaturen
(...gestures: Composable[]): ComposedGestureParameter
| Name | Typ | Erforderlich | Beschreibung |
|---|---|---|---|
...gestures | Composable[] | Ja | — |
Rückgabe
Generiert aus den öffentlichen TypeScript-Deklarationen: Signaturen, Props und Standardwerte stammen aus der geprüften Quelle, Beschreibungen aus deren JSDoc. Kein Standardwert ist erfunden.