@nativescript/core
Version:
A JavaScript library providing an easy to use api for interacting with iOS and Android platform APIs.
83 lines (82 loc) • 3.07 kB
TypeScript
import { Animation } from '../animation';
import { AnimationDefinition } from '../animation/animation-interfaces';
import type { View } from '../core/view';
export type TouchAnimationFn = (view: View) => void;
export type TouchAnimationOptions = {
up?: TouchAnimationFn | AnimationDefinition;
down?: TouchAnimationFn | AnimationDefinition;
};
export declare enum TouchAnimationTypes {
up = "up",
down = "down"
}
export type VisionHoverEffect = 'automatic' | 'highlight' | 'lift';
export type VisionHoverShape = 'circle' | 'rect';
export type VisionHoverOptions = {
effect: VisionHoverEffect;
shape?: VisionHoverShape;
shapeCornerRadius?: number;
};
/**
* Manage interactivity in your apps easily with TouchManager.
* Store reusable down/up animation settings for touches as well as optionally enable automatic tap (down/up) animations for your app.
*/
export declare class TouchManager {
/**
* Enable animations for all tap bindings in the UI.
*/
static enableGlobalTapAnimations: boolean;
/**
* (visionOS Only) Enable hoverStyle for all tap bindings in the UI.
*/
static enableGlobalHoverWhereTap: boolean;
/**
* Define reusable hover styles keyed by name to use throughout your UI.
*/
static visionHoverOptions: {
[key: string]: VisionHoverOptions;
};
/**
* Used internally - defines reusable UIHoverStyle's
*/
static visionHoverStyleCache: {
[key: string]: UIHoverStyle;
};
/**
* Define reusable touch animations to use on views with touchAnimation defined or with enableGlobalTapAnimations on.
*/
static animations: TouchAnimationOptions;
/**
* Native Touch handlers (iOS only) registered with the view through the TouchManager.
* The TouchManager uses this internally but makes public for other versatility if needed.
*/
static touchHandlers: Array<{
view: View;
handler: any;
}>;
/**
* When using NativeScript AnimationDefinition's for touch animations this will contain any instances for finer grain control of starting/stopping under various circumstances.
* The TouchManager uses this internally but makes public for other versatility if needed.
*/
static touchAnimationDefinitions: Array<{
view: View;
animation: Animation;
type: TouchAnimationTypes;
}>;
/**
* The TouchManager uses this internally.
* Adds touch animations to view based upon it's touchAnimation property or TouchManager.animations.
* @param view NativeScript view instance
*/
static addAnimations(view: View): void;
static startAnimationForType(view: View, type: TouchAnimationTypes): void;
/**
* The TouchManager uses this internally.
* Adds visionOS hover styles to views based upon it's visionHoverStyle property
* @param view NativeScript view instance
*/
static addHoverStyle(view: View): void;
}
export declare let TouchControlHandler: {
initWithOwner: (owner: WeakRef<View>) => any;
};