UNPKG

2.12 kBTypeScriptView Raw
1import { Animation } from '../animation';
2import { AnimationDefinition } from '../animation/animation-interfaces';
3import { View } from '../core/view';
4export type TouchAnimationFn = (view: View) => void;
5export type TouchAnimationOptions = {
6 up?: TouchAnimationFn | AnimationDefinition;
7 down?: TouchAnimationFn | AnimationDefinition;
8};
9export declare enum TouchAnimationTypes {
10 up = "up",
11 down = "down"
12}
13/**
14 * Manage interactivity in your apps easily with TouchManager.
15 * Store reusable down/up animation settings for touches as well as optionally enable automatic tap (down/up) animations for your app.
16 */
17export declare class TouchManager {
18 /**
19 * Enable animations for all tap bindings in the UI.
20 */
21 static enableGlobalTapAnimations: boolean;
22 /**
23 * Define reusable touch animations to use on views with touchAnimation defined or with enableGlobalTapAnimations on.
24 */
25 static animations: TouchAnimationOptions;
26 /**
27 * Native Touch handlers (iOS only) registered with the view through the TouchManager.
28 * The TouchManager uses this internally but makes public for other versatility if needed.
29 */
30 static touchHandlers: Array<{
31 view: View;
32 handler: any;
33 }>;
34 /**
35 * When using NativeScript AnimationDefinition's for touch animations this will contain any instances for finer grain control of starting/stopping under various circumstances.
36 * The TouchManager uses this internally but makes public for other versatility if needed.
37 */
38 static touchAnimationDefinitions: Array<{
39 view: View;
40 animation: Animation;
41 type: TouchAnimationTypes;
42 }>;
43 /**
44 * The TouchManager uses this internally.
45 * Adds touch animations to view based upon it's touchAnimation property or TouchManager.animations.
46 * @param view NativeScript view instance
47 */
48 static addAnimations(view: View): void;
49 static startAnimationForType(view: View, type: TouchAnimationTypes): void;
50}
51export declare let TouchControlHandler: {
52 initWithOwner: (owner: WeakRef<View>) => any;
53};