Verwendung

Read a long press location and duration.

Dieser Typ wird verwendet von longPress

tsx
// 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

ts
export interface LongPressOptions extends Common, Callbacks<LongPressEvent, LongPressEvent> {
  /** Milliseconds held before it activates; 500 by default. */
  after?: number;
  maxDistance?: number;
}

Mitglieder 7

NameTypErforderlichBeschreibung
afternumberNeinMilliseconds held before it activates; 500 by default.
maxDistancenumberNein—
disabledbooleanNeinIgnores touches, like a disabled Pressable.
hitAreaHitAreaNeinInsets of the area that takes touches: one for every edge, or by edge.
onStart(event: LongPressEvent) => voidNeinIt activated.
onChange(event: LongPressEvent) => voidNeinIt moved, with the change since the last move.
onEnd(event: LongPressEvent, success: boolean) => voidNeinIt ended after activating: success is false when it was cancelled.
onStart — Methodensignaturen

Signaturen

ts
(event: LongPressEvent): void

Parameter

NameTypErforderlichBeschreibung
eventLongPressEventJa—

Rückgabe

void

onChange — Methodensignaturen

Signaturen

ts
(event: LongPressEvent): void

Parameter

NameTypErforderlichBeschreibung
eventLongPressEventJa—

Rückgabe

void

onEnd — Methodensignaturen

Signaturen

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

Parameter

NameTypErforderlichBeschreibung
eventLongPressEventJa—
successbooleanJa—

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.