FlingOptions
Sets the directions a fling() gesture answers to, and the callbacks that run when it is recognized.
Utilização
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'))),
]}
/>;Declaração do tipo
export interface FlingOptions extends Common, Callbacks<FlingEvent, FlingEvent> {
/** Where it may go; right by default. */
direction?: FlingDirection | readonly FlingDirection[];
}Membros 6
| Nome | Tipo | Obrigatório | Descrição |
|---|---|---|---|
direction | FlingDirection | readonly FlingDirection[] | Não | Where it may go; right by default. |
disabled | boolean | Não | Ignores touches, like a disabled Pressable. |
hitArea | HitArea | Não | Insets of the area that takes touches: one for every edge, or by edge. |
onStart | (event: PositionEvent) => void | Não | It activated. |
onChange | (event: PositionEvent) => void | Não | It moved, with the change since the last move. |
onEnd | (event: PositionEvent, success: boolean) => void | Não | It ended after activating: success is false when it was cancelled. |
onStart — assinaturas de método
Assinaturas
(event: PositionEvent): voidParâmetros
| Nome | Tipo | Obrigatório | Descrição |
|---|---|---|---|
event | PositionEvent | Sim | — |
Devolve
void
onChange — assinaturas de método
Assinaturas
(event: PositionEvent): voidParâmetros
| Nome | Tipo | Obrigatório | Descrição |
|---|---|---|---|
event | PositionEvent | Sim | — |
Devolve
void
onEnd — assinaturas de método
Assinaturas
(event: PositionEvent, success: boolean): voidParâmetros
| Nome | Tipo | Obrigatório | Descrição |
|---|---|---|---|
event | PositionEvent | Sim | — |
success | boolean | Sim | — |
Devolve
void
Gerado a partir das declarações TypeScript públicas: assinaturas, props e predefinições vêm da fonte verificada, as descrições da sua JSDoc. Nenhuma predefinição é inventada.