Utilisation

Set a value from a rotation gesture.

Ce type est utilisé par 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} />
  );
}

Déclaration du type

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

Membres 5

NomTypeRequisDescription
disabledbooleanNonIgnores touches, like a disabled Pressable.
hitAreaHitAreaNonInsets of the area that takes touches: one for every edge, or by edge.
onStart(event: RotationEvent) => voidNonIt activated.
onChange(event: RotationChangeEvent) => voidNonIt moved, with the change since the last move.
onEnd(event: RotationEvent, success: boolean) => voidNonIt ended after activating: success is false when it was cancelled.
onStart — signatures de méthode

Signatures

ts
(event: RotationEvent): void

Paramètres

NomTypeRequisDescription
eventRotationEventOui—

Retourne

void

onChange — signatures de méthode

Signatures

ts
(event: RotationChangeEvent): void

Paramètres

NomTypeRequisDescription
eventRotationChangeEventOui—

Retourne

void

onEnd — signatures de méthode

Signatures

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

Paramètres

NomTypeRequisDescription
eventRotationEventOui—
successbooleanOui—

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.