@nativescript-community/gesturehandler
Version:
Declarative API exposing platform native touch and gesture system to NativeScript.
98 lines (97 loc) • 4.08 kB
TypeScript
import Observable from '@nativescript-community/observable';
import { EventData, GridLayout } from '@nativescript/core';
import { CssProperty, Style, View } from '@nativescript/core/ui';
import { FlingGestureHandler, FlingGestureHandlerOptions, ForceTouchGestureHandler, ForceTouchGestureHandlerOptions, Handler, LongPressGestureHandler, LongPressGestureHandlerOptions, NativePropertyOptions, NativeViewGestureHandler, NativeViewGestureHandlerOptions, PanGestureHandler, PanGestureHandlerOptions, PinchGestureHandler, PinchGestureHandlerOptions, RotationGestureHandler, RotationGestureHandlerOptions, TapGestureHandler, TapGestureHandlerOptions } from './gesturehandler';
export declare const GestureHandlerStateEvent = "GestureHandlerStateEvent";
export declare const GestureHandlerTouchEvent = "GestureHandlerTouchEvent";
export declare const ROOT_GESTURE_HANDLER_TAG = -12345;
export declare enum HandlerType {
PAN = "pan",
TAP = "tap",
FLING = "fling",
LONG_PRESS = "longPress",
NATIVE_VIEW = "nativeView",
PINCH = "pinch",
ROTATION = "rotation",
FORCE_TOUCH = "forceTouch"
}
export interface OptionsTypeMap {
[HandlerType.TAP]: TapGestureHandlerOptions;
[HandlerType.LONG_PRESS]: LongPressGestureHandlerOptions;
[HandlerType.PINCH]: PinchGestureHandlerOptions;
[HandlerType.FLING]: FlingGestureHandlerOptions;
[HandlerType.PAN]: PanGestureHandlerOptions;
[HandlerType.ROTATION]: RotationGestureHandlerOptions;
[HandlerType.NATIVE_VIEW]: NativeViewGestureHandlerOptions;
[HandlerType.FORCE_TOUCH]: ForceTouchGestureHandlerOptions;
}
export interface TypeMap {
[HandlerType.TAP]: TapGestureHandler;
[HandlerType.LONG_PRESS]: LongPressGestureHandler;
[HandlerType.PINCH]: PinchGestureHandler;
[HandlerType.FLING]: FlingGestureHandler;
[HandlerType.PAN]: PanGestureHandler;
[HandlerType.ROTATION]: RotationGestureHandler;
[HandlerType.NATIVE_VIEW]: NativeViewGestureHandler;
[HandlerType.FORCE_TOUCH]: ForceTouchGestureHandler;
}
export declare function nativeProperty(target: any, k?: any, desc?: PropertyDescriptor): any;
export declare function nativeProperty(options: NativePropertyOptions): (target: any, k?: any, desc?: PropertyDescriptor) => any;
export declare abstract class BaseNative<T, U extends {}> extends Observable {
options?: U;
constructor(options?: U, native?: T);
native: T;
initNativeView(native: T, options: U): void;
disposeNativeView(): void;
getNative(): T;
abstract createNative(options: U): T;
}
export declare abstract class ManagerBase extends Observable {
abstract createGestureHandler<T extends HandlerType>(handlerName: T, handlerTag: number, config?: OptionsTypeMap[T]): TypeMap[T];
}
export declare enum GestureState {
UNDETERMINED = 0,
FAILED = 1,
BEGAN = 2,
CANCELLED = 3,
ACTIVE = 4,
END = 5
}
export interface GestureStateEventData extends EventData {
object: Handler<any, any>;
data: {
state: GestureState;
prevState: GestureState;
ios?: any;
android?: any;
view: View;
extraData: {
[k: string]: number;
};
};
}
export interface GestureTouchEventData extends EventData {
object: Handler<any, any>;
data: {
state: GestureState;
ios?: any;
android?: any;
view?: View;
extraData: {
[k: string]: number;
};
};
}
export declare class BaseGestureRootView extends GridLayout {
}
export declare function applyMixins(derivedCtor: any, baseCtors: any[], options?: {
after?: boolean;
override?: boolean;
omit?: (string | symbol)[];
}): void;
export declare const exclusiveTouchProperty: CssProperty<Style, boolean>;
export declare const disallowInterceptTouchProperty: CssProperty<Style, boolean>;
export declare const ViewInitEvent = "ViewInitEvent";
export declare const ViewDisposeEvent = "ViewDisposeEvent";
export declare function overrideViewBase(): void;
export declare function install(overrideNGestures?: boolean): void;