FlingOptions
Sets the directions a fling() gesture answers to, and the callbacks that run when it is recognized.
Verwendung
Configure a directional flick.
// Configure a directional flick.
import { Box, fling, haptics, type FlingOptions } from 'kuito';
function swipeTo(direction: 'left' | 'right', action: () => void): FlingOptions {
return {
direction,
hitArea: { horizontal: 20 },
onEnd: (_, success) => {
if (!success) return;
void haptics.impact('light');
action();
},
};
}
<Box
gestures={[
fling(swipeTo('left', () => console.log('archive'))),
fling(swipeTo('right', () => console.log('pin'))),
]}
/>;Typdeklaration
export interface FlingOptions extends Common, Callbacks<FlingEvent, FlingEvent> {
/** Where it may go; right by default. */
direction?: FlingDirection | readonly FlingDirection[];
}Mitglieder 6
| Name | Typ | Erforderlich | Beschreibung |
|---|---|---|---|
direction | FlingDirection | readonly FlingDirection[] | Nein | Where it may go; right by default. |
disabled | boolean | Nein | Ignores touches, like a disabled Pressable. |
hitArea | HitArea | Nein | Insets of the area that takes touches: one for every edge, or by edge. |
onStart | (event: PositionEvent) => void | Nein | It activated. |
onChange | (event: PositionEvent) => void | Nein | It moved, with the change since the last move. |
onEnd | (event: PositionEvent, success: boolean) => void | Nein | It ended after activating: success is false when it was cancelled. |
onStart — Methodensignaturen
Signaturen
(event: PositionEvent): voidParameter
| Name | Typ | Erforderlich | Beschreibung |
|---|---|---|---|
event | PositionEvent | Ja | — |
Rückgabe
void
onChange — Methodensignaturen
Signaturen
(event: PositionEvent): voidParameter
| Name | Typ | Erforderlich | Beschreibung |
|---|---|---|---|
event | PositionEvent | Ja | — |
Rückgabe
void
onEnd — Methodensignaturen
Signaturen
(event: PositionEvent, success: boolean): voidParameter
| Name | Typ | Erforderlich | Beschreibung |
|---|---|---|---|
event | PositionEvent | Ja | — |
success | boolean | Ja | — |
Rückgabe
void
Generiert aus den öffentlichen TypeScript-Deklarationen: Signaturen, Props und Standardwerte stammen aus der geprüften Quelle, Beschreibungen aus deren JSDoc. Kein Standardwert ist erfunden.