LongPressOptions
Sets how long a longPress() gesture must be held and how far the finger may wander, and its callbacks.
Utilização
Read a long press location and duration.
Este tipo é usado por 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} />;Declaração do tipo
export interface LongPressOptions extends Common, Callbacks<LongPressEvent, LongPressEvent> {
/** Milliseconds held before it activates; 500 by default. */
after?: number;
maxDistance?: number;
}Membros 7
| Nome | Tipo | Obrigatório | Descrição |
|---|---|---|---|
after | number | Não | Milliseconds held before it activates; 500 by default. |
maxDistance | number | Não | — |
disabled | boolean | Não | Ignores touches, like a disabled Pressable. |
hitArea | HitArea | Não | Insets of the area that takes touches: one for every edge, or by edge. |
onStart | (event: LongPressEvent) => void | Não | It activated. |
onChange | (event: LongPressEvent) => void | Não | It moved, with the change since the last move. |
onEnd | (event: LongPressEvent, success: boolean) => void | Não | It ended after activating: success is false when it was cancelled. |
onStart — assinaturas de método
Assinaturas
(event: LongPressEvent): voidParâmetros
| Nome | Tipo | Obrigatório | Descrição |
|---|---|---|---|
event | LongPressEvent | Sim | — |
Devolve
void
onChange — assinaturas de método
Assinaturas
(event: LongPressEvent): voidParâmetros
| Nome | Tipo | Obrigatório | Descrição |
|---|---|---|---|
event | LongPressEvent | Sim | — |
Devolve
void
onEnd — assinaturas de método
Assinaturas
(event: LongPressEvent, success: boolean): voidParâmetros
| Nome | Tipo | Obrigatório | Descrição |
|---|---|---|---|
event | LongPressEvent | Sim | — |
success | boolean | Sim | — |
Devolve
void
Gerado a partir das declarações TypeScript públicas: assinaturas, props e predefinições vêm da fonte verificada, as descrições da sua JSDoc. Nenhuma predefinição é inventada.