LongPressOptions
Sets how long a longPress() gesture must be held and how far the finger may wander, and its callbacks.
Verwendung
Read a long press location and duration.
Dieser Typ wird verwendet von longPress
// Read a long press location and duration.
import { Box, longPress, signal, type LongPressEvent } from 'kuito';
const menuAt = signal<{ x: number; y: number } | null>(null);
// Opens a menu where the finger rests, once it has been held.
const open = (event: LongPressEvent) => {
menuAt.value = { x: event.absoluteX, y: event.absoluteY };
};
<Box gestures={[longPress({ after: 400, onStart: open })]} height={64} />;Typdeklaration
export interface LongPressOptions extends Common, Callbacks<LongPressEvent, LongPressEvent> {
/** Milliseconds held before it activates; 500 by default. */
after?: number;
maxDistance?: number;
}Mitglieder 7
| Name | Typ | Erforderlich | Beschreibung |
|---|---|---|---|
after | number | Nein | Milliseconds held before it activates; 500 by default. |
maxDistance | number | Nein | — |
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: LongPressEvent) => void | Nein | It activated. |
onChange | (event: LongPressEvent) => void | Nein | It moved, with the change since the last move. |
onEnd | (event: LongPressEvent, success: boolean) => void | Nein | It ended after activating: success is false when it was cancelled. |
onStart — Methodensignaturen
Signaturen
(event: LongPressEvent): voidParameter
| Name | Typ | Erforderlich | Beschreibung |
|---|---|---|---|
event | LongPressEvent | Ja | — |
Rückgabe
void
onChange — Methodensignaturen
Signaturen
(event: LongPressEvent): voidParameter
| Name | Typ | Erforderlich | Beschreibung |
|---|---|---|---|
event | LongPressEvent | Ja | — |
Rückgabe
void
onEnd — Methodensignaturen
Signaturen
(event: LongPressEvent, success: boolean): voidParameter
| Name | Typ | Erforderlich | Beschreibung |
|---|---|---|---|
event | LongPressEvent | 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.