PanOptions
Restricts a pan() gesture to one axis or a distance before it starts, and sets its callbacks.
Usage
Type a shared gesture callback.
This type is used by pan
// Type a shared gesture callback.
import { Box, pan, tap, type GestureEvent } from 'kuito';
// Any gesture's event carries how many fingers it involves.
const logFingers = (event: GestureEvent) => console.log(`${event.numberOfPointers} finger(s)`);
<Box gestures={[tap({ onEnd: logFingers }), pan({ onStart: logFingers })]} />;Type declaration
export interface PanOptions extends Common, Callbacks<PanEvent, PanChangeEvent> {
/** Only along one axis: it starts after 10 along it and fails after 10 across. */
axis?: 'x' | 'y';
/** How far it moves before it activates. */
minDistance?: number;
}Members 7
| Name | Type | Required | Description |
|---|---|---|---|
axis | "x" | "y" | No | Only along one axis: it starts after 10 along it and fails after 10 across. |
minDistance | number | No | How far it moves before it activates. |
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: PanEvent) => void | No | It activated. |
onChange | (event: PanChangeEvent) => void | No | It moved, with the change since the last move. |
onEnd | (event: PanEvent, success: boolean) => void | No | It ended after activating: success is false when it was cancelled. |
onStart — method signatures
Signatures
onChange — method signatures
Signatures
(event: PanChangeEvent): voidParameters
| Name | Type | Required | Description |
|---|---|---|---|
event | PanChangeEvent | Yes | — |
Returns
void
onEnd — method signatures
Signatures
(event: PanEvent, success: boolean): voidParameters
| Name | Type | Required | Description |
|---|---|---|---|
event | PanEvent | 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.