RotateOptions
Sets a rotate() gesture's callbacks, and when and where it takes touches.
Verwendung
Set a value from a rotation gesture.
Dieser Typ wird verwendet von rotate
// 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} />
);
}Typdeklaration
export type RotateOptions = Common & Callbacks<RotationEvent, RotationChangeEvent>;Mitglieder 5
| Name | Typ | Erforderlich | Beschreibung |
|---|---|---|---|
disabled | boolean | Nein | Ignores touches, like a disabled Pressable. |
hitArea | HitArea | Nein | Insets of the area that takes touches: one for every edge, or by edge. |
onStart | (event: RotationEvent) => void | Nein | It activated. |
onChange | (event: RotationChangeEvent) => void | Nein | It moved, with the change since the last move. |
onEnd | (event: RotationEvent, success: boolean) => void | Nein | It ended after activating: success is false when it was cancelled. |
onStart — Methodensignaturen
Signaturen
(event: RotationEvent): voidParameter
| Name | Typ | Erforderlich | Beschreibung |
|---|---|---|---|
event | RotationEvent | Ja | — |
Rückgabe
void
onChange — Methodensignaturen
Signaturen
(event: RotationChangeEvent): voidParameter
| Name | Typ | Erforderlich | Beschreibung |
|---|---|---|---|
event | RotationChangeEvent | Ja | — |
Rückgabe
void
onEnd — Methodensignaturen
Signaturen
(event: RotationEvent, success: boolean): voidParameter
| Name | Typ | Erforderlich | Beschreibung |
|---|---|---|---|
event | RotationEvent | Ja | — |
success | boolean | Ja | — |
Rückgabe
void
Generiert aus den öffentlichen TypeScript-Deklarationen: Signaturen, Props und Standardwerte stammen aus der geprüften Quelle, Beschreibungen aus deren JSDoc. Kein Standardwert ist erfunden.