Utilização

Set a value from a rotation gesture.

Este tipo é usado por rotate

tsx
// Set a value from a rotation gesture.
import { Box, motion, rotate, spring, type RotationEvent } from 'kuito';

function Dial(props: { onSet: (degrees: number) => void }) {
  const turn = rotate().release(spring());
  const angle = motion(0).follows(turn.rotation);

  const settle = (event: RotationEvent) => props.onSet(Math.round(event.rotation / 15) * 15);

  return (
    <Box rotate={angle} gestures={[rotate({ onEnd: settle }), turn]} width={120} height={120} />
  );
}

Declaração do tipo

ts
export type RotateOptions = Common & Callbacks<RotationEvent, RotationChangeEvent>;

Membros 5

NomeTipoObrigatórioDescrição
disabledbooleanNãoIgnores touches, like a disabled Pressable.
hitAreaHitAreaNãoInsets of the area that takes touches: one for every edge, or by edge.
onStart(event: RotationEvent) => voidNãoIt activated.
onChange(event: RotationChangeEvent) => voidNãoIt moved, with the change since the last move.
onEnd(event: RotationEvent, success: boolean) => voidNãoIt ended after activating: success is false when it was cancelled.
onStart — assinaturas de método

Assinaturas

ts
(event: RotationEvent): void

Parâmetros

NomeTipoObrigatórioDescrição
eventRotationEventSim—

Devolve

void

onChange — assinaturas de método

Assinaturas

ts
(event: RotationChangeEvent): void

Parâmetros

NomeTipoObrigatórioDescrição
eventRotationChangeEventSim—

Devolve

void

onEnd — assinaturas de método

Assinaturas

ts
(event: RotationEvent, success: boolean): void

Parâmetros

NomeTipoObrigatórioDescrição
eventRotationEventSim—
successbooleanSim—

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.