Callbacks
Callbacks for what needs JavaScript; the compiler places each one.
Utilização
Add haptic feedback to a gesture.
// Add haptic feedback to a gesture.
import { Box, haptics, pan, type Callbacks, type PanChangeEvent, type PanEvent } from 'kuito';
// Shared feedback for every draggable in the app.
const feedback: Callbacks<PanEvent, PanChangeEvent> = {
onStart: () => void haptics.selection(),
onEnd: (_, success) => void (success && haptics.impact('light')),
};
<Box gestures={[pan({ axis: 'x', ...feedback })]} />;Declaração do tipo
export interface Callbacks<Event, Change> {
/** It activated. */
onStart?: (event: Event) => void;
/** It moved, with the change since the last move. */
onChange?: (event: Change) => void;
/** It ended after activating: `success` is false when it was cancelled. */
onEnd?: (event: Event, success: boolean) => void;
}Membros 3
| Nome | Tipo | Obrigatório | Descrição |
|---|---|---|---|
onStart | (event: Event) => void | Não | It activated. |
onChange | (event: Change) => void | Não | It moved, with the change since the last move. |
onEnd | (event: Event, success: boolean) => void | Não | It ended after activating: success is false when it was cancelled. |
onStart — assinaturas de método
Assinaturas
(event: Event): voidParâmetros
| Nome | Tipo | Obrigatório | Descrição |
|---|---|---|---|
event | Event | Sim | — |
Devolve
void
onChange — assinaturas de método
Assinaturas
(event: Change): voidParâmetros
| Nome | Tipo | Obrigatório | Descrição |
|---|---|---|---|
event | Change | Sim | — |
Devolve
void
onEnd — assinaturas de método
Assinaturas
(event: Event, success: boolean): voidParâmetros
| Nome | Tipo | Obrigatório | Descrição |
|---|---|---|---|
event | Event | 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.