Utilização

Recognize a directional swipe.

Este tipo é usado por fling

tsx
// Recognize a directional swipe.
import { Box, fling, signal } from 'kuito';

const page = signal(0);

const swipe = fling({
  direction: ['left', 'right'],
  onEnd: (event, success) => {
    if (success) page.value += 1;
  },
});

<Box gestures={[swipe]} />;

Declaração do tipo

ts
export interface Gesture {
  readonly __kuitoGesture: 'gesture';
  readonly type: GestureType;
  readonly kind: GestureKind;
  readonly config: Readonly<Record<string, unknown>>;
  readonly callbacks: Readonly<Callbacks<never, never>>;
  /** How the motion values following it let go when it ends. */
  readonly releasing?: Animation<unknown>;
  /**
   * The same gesture, letting go with `animation`: each follower runs it with
   * the gesture's velocity, toward its own home (its first value) unless the
   * animation names a target.
   */
  release(animation: Animation<unknown>): this;
  /** 1 while it is active, 0 otherwise. */
  readonly active: GestureSource;
}

Membros 7

NomeTipoObrigatórioDescrição
typesó de leituraGestureTypeSim—
kindsó de leituraGestureKindSim—
configsó de leituraReadonly<Record<string, unknown>>Sim—
callbackssó de leituraReadonly<Callbacks<never, never>>Sim—
releasingsó de leituraAnimation<unknown>NãoHow the motion values following it let go when it ends.
release(animation: Animation<unknown>) => GestureSimThe same gesture, letting go with animation: each follower runs it with the gesture's velocity, toward its own home (its first value) unless the animation names a target.
activesó de leituraGestureSourceSim1 while it is active, 0 otherwise.
release — assinaturas de método

Assinaturas

ts
(animation: Animation<unknown>): Gesture

Parâmetros

NomeTipoObrigatórioDescrição
animationAnimation<unknown>Sim—

Devolve

Gesture

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.