1 | import * as React from 'react';
|
2 | import { State } from '../State';
|
3 | import { TouchEventType } from '../TouchEventType';
|
4 | import { ValueOf } from '../typeUtils';
|
5 | import { PointerType } from '../PointerType';
|
6 | export declare const baseGestureHandlerProps: readonly ["id", "enabled", "shouldCancelWhenOutside", "hitSlop", "cancelsTouchesInView", "userSelect", "activeCursor", "mouseButton", "enableContextMenu", "touchAction", "waitFor", "simultaneousHandlers", "blocksHandlers", "onBegan", "onFailed", "onCancelled", "onActivated", "onEnded", "onGestureEvent", "onHandlerStateChange"];
|
7 | export declare const baseGestureHandlerWithDetectorProps: string[];
|
8 | export interface GestureEventPayload {
|
9 | handlerTag: number;
|
10 | numberOfPointers: number;
|
11 | state: ValueOf<typeof State>;
|
12 | pointerType: PointerType;
|
13 | }
|
14 | export interface HandlerStateChangeEventPayload extends GestureEventPayload {
|
15 | oldState: ValueOf<typeof State>;
|
16 | }
|
17 | export type HitSlop = number | null | undefined | Partial<Record<'left' | 'right' | 'top' | 'bottom' | 'vertical' | 'horizontal', number>> | Record<'width' | 'left', number> | Record<'width' | 'right', number> | Record<'height' | 'top', number> | Record<'height' | 'bottom', number>;
|
18 | export type UserSelect = 'none' | 'auto' | 'text';
|
19 | export type ActiveCursor = 'auto' | 'default' | 'none' | 'context-menu' | 'help' | 'pointer' | 'progress' | 'wait' | 'cell' | 'crosshair' | 'text' | 'vertical-text' | 'alias' | 'copy' | 'move' | 'no-drop' | 'not-allowed' | 'grab' | 'grabbing' | 'e-resize' | 'n-resize' | 'ne-resize' | 'nw-resize' | 's-resize' | 'se-resize' | 'sw-resize' | 'w-resize' | 'ew-resize' | 'ns-resize' | 'nesw-resize' | 'nwse-resize' | 'col-resize' | 'row-resize' | 'all-scroll' | 'zoom-in' | 'zoom-out';
|
20 | export declare enum MouseButton {
|
21 | LEFT = 1,
|
22 | RIGHT = 2,
|
23 | MIDDLE = 4,
|
24 | BUTTON_4 = 8,
|
25 | BUTTON_5 = 16,
|
26 | ALL = 31
|
27 | }
|
28 | export type TouchAction = 'auto' | 'none' | 'pan-x' | 'pan-left' | 'pan-right' | 'pan-y' | 'pan-up' | 'pan-down' | 'pinch-zoom' | 'manipulation' | 'inherit' | 'initial' | 'revert' | 'revert-layer' | 'unset';
|
29 | export interface GestureEvent<ExtraEventPayloadT = Record<string, unknown>> {
|
30 | nativeEvent: Readonly<GestureEventPayload & ExtraEventPayloadT>;
|
31 | }
|
32 | export interface HandlerStateChangeEvent<ExtraEventPayloadT = Record<string, unknown>> {
|
33 | nativeEvent: Readonly<HandlerStateChangeEventPayload & ExtraEventPayloadT>;
|
34 | }
|
35 | export type TouchData = {
|
36 | id: number;
|
37 | x: number;
|
38 | y: number;
|
39 | absoluteX: number;
|
40 | absoluteY: number;
|
41 | };
|
42 | export type GestureTouchEvent = {
|
43 | handlerTag: number;
|
44 | numberOfTouches: number;
|
45 | state: ValueOf<typeof State>;
|
46 | eventType: TouchEventType;
|
47 | allTouches: TouchData[];
|
48 | changedTouches: TouchData[];
|
49 | pointerType: PointerType;
|
50 | };
|
51 | export type GestureUpdateEvent<GestureEventPayloadT = Record<string, unknown>> = GestureEventPayload & GestureEventPayloadT;
|
52 | export type GestureStateChangeEvent<GestureStateChangeEventPayloadT = Record<string, unknown>> = HandlerStateChangeEventPayload & GestureStateChangeEventPayloadT;
|
53 | export type CommonGestureConfig = {
|
54 | enabled?: boolean;
|
55 | shouldCancelWhenOutside?: boolean;
|
56 | hitSlop?: HitSlop;
|
57 | userSelect?: UserSelect;
|
58 | activeCursor?: ActiveCursor;
|
59 | mouseButton?: MouseButton;
|
60 | enableContextMenu?: boolean;
|
61 | touchAction?: TouchAction;
|
62 | };
|
63 | export type BaseGestureHandlerProps<ExtraEventPayloadT extends Record<string, unknown> = Record<string, unknown>> = CommonGestureConfig & {
|
64 | id?: string;
|
65 | waitFor?: React.Ref<unknown> | React.Ref<unknown>[];
|
66 | simultaneousHandlers?: React.Ref<unknown> | React.Ref<unknown>[];
|
67 | blocksHandlers?: React.Ref<unknown> | React.Ref<unknown>[];
|
68 | testID?: string;
|
69 | cancelsTouchesInView?: boolean;
|
70 | onBegan?: (event: HandlerStateChangeEvent) => void;
|
71 | onFailed?: (event: HandlerStateChangeEvent) => void;
|
72 | onCancelled?: (event: HandlerStateChangeEvent) => void;
|
73 | onActivated?: (event: HandlerStateChangeEvent) => void;
|
74 | onEnded?: (event: HandlerStateChangeEvent) => void;
|
75 | onGestureEvent?: (event: GestureEvent<ExtraEventPayloadT>) => void;
|
76 | onHandlerStateChange?: (event: HandlerStateChangeEvent<ExtraEventPayloadT>) => void;
|
77 | children?: React.ReactNode;
|
78 | };
|