FlingOptions
Sets the directions a fling() gesture answers to, and the callbacks that run when it is recognized.
Utilisation
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'))),
]}
/>;Déclaration du type
export interface FlingOptions extends Common, Callbacks<FlingEvent, FlingEvent> {
/** Where it may go; right by default. */
direction?: FlingDirection | readonly FlingDirection[];
}Membres 6
| Nom | Type | Requis | Description |
|---|---|---|---|
direction | FlingDirection | readonly FlingDirection[] | Non | Where it may go; right by default. |
disabled | boolean | Non | Ignores touches, like a disabled Pressable. |
hitArea | HitArea | Non | Insets of the area that takes touches: one for every edge, or by edge. |
onStart | (event: PositionEvent) => void | Non | It activated. |
onChange | (event: PositionEvent) => void | Non | It moved, with the change since the last move. |
onEnd | (event: PositionEvent, success: boolean) => void | Non | It ended after activating: success is false when it was cancelled. |
onStart — signatures de méthode
Signatures
(event: PositionEvent): voidParamètres
| Nom | Type | Requis | Description |
|---|---|---|---|
event | PositionEvent | Oui | — |
Retourne
void
onChange — signatures de méthode
Signatures
(event: PositionEvent): voidParamètres
| Nom | Type | Requis | Description |
|---|---|---|---|
event | PositionEvent | Oui | — |
Retourne
void
onEnd — signatures de méthode
Signatures
(event: PositionEvent, success: boolean): voidParamètres
| Nom | Type | Requis | Description |
|---|---|---|---|
event | PositionEvent | Oui | — |
success | boolean | Oui | — |
Retourne
void
Généré depuis les déclarations TypeScript publiques : signatures, props et valeurs par défaut viennent de la source vérifiée, les descriptions de sa JSDoc. Aucune valeur par défaut n'est inventée.