RotateOptions
Sets a rotate() gesture's callbacks, and when and where it takes touches.
Usage
Set a value from a rotation gesture.
This type is used by 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} />
);
}Type declaration
export type RotateOptions = Common & Callbacks<RotationEvent, RotationChangeEvent>;Members 5
| Name | Type | Required | Description |
|---|---|---|---|
disabled | boolean | No | Ignores touches, like a disabled Pressable. |
hitArea | HitArea | No | Insets of the area that takes touches: one for every edge, or by edge. |
onStart | (event: RotationEvent) => void | No | It activated. |
onChange | (event: RotationChangeEvent) => void | No | It moved, with the change since the last move. |
onEnd | (event: RotationEvent, success: boolean) => void | No | It ended after activating: success is false when it was cancelled. |
onStart — method signatures
Signatures
(event: RotationEvent): voidParameters
| Name | Type | Required | Description |
|---|---|---|---|
event | RotationEvent | Yes | — |
Returns
void
onChange — method signatures
Signatures
(event: RotationChangeEvent): voidParameters
| Name | Type | Required | Description |
|---|---|---|---|
event | RotationChangeEvent | Yes | — |
Returns
void
onEnd — method signatures
Signatures
(event: RotationEvent, success: boolean): voidParameters
| Name | Type | Required | Description |
|---|---|---|---|
event | RotationEvent | Yes | — |
success | boolean | Yes | — |
Returns
void
Generated from the public TypeScript declarations: signatures, props and defaults come from the checked source, descriptions from its JSDoc. No defaults are invented.