@nativescript/core
Version:
A JavaScript library providing an easy to use api for interacting with iOS and Android platform APIs.
191 lines (190 loc) • 8.68 kB
TypeScript
import { Color } from '../color';
export declare function dataDeserialize(nativeData?: any): any;
export declare function dataSerialize(data: any, wrapPrimitives?: boolean): any;
declare function getCurrentAppPath(): string;
declare function joinPaths(...paths: string[]): string;
export declare function getter<T>(_this: any, property: T | {
(): T;
}): T;
declare namespace collections {
function jsArrayToNSArray<T>(str: T[]): NSArray<T>;
function nsArrayToJSArray<T>(a: NSArray<T>): Array<T>;
}
declare function getRootViewController(): UIViewController;
/**
* The UIWindow NativeScript is driving.
*
* Resolved from the active window, then the recorded primary window, then UIKit's own
* key window lookups. The UIKit lookups come last because `UIApplication.keyWindow` is
* deprecated and, in a scene-based app, key status can sit on any connected scene's
* window - including one NativeScript does not own.
*/
export declare function getWindow(): UIWindow;
declare function getMainScreen(): UIScreen;
declare function setWindowBackgroundColor(value: string): void;
declare function isLandscape(): boolean;
export declare function openFile(filePath: string): boolean;
declare function getVisibleViewController(rootViewController: UIViewController): UIViewController;
declare function applyRotateTransform(transform: CATransform3D, x: number, y: number, z: number): CATransform3D;
declare function createUIDocumentInteractionControllerDelegate(): NSObject;
export declare function isRealDevice(): boolean;
declare function printCGRect(rect: CGRect): string;
declare function snapshotView(view: UIView, scale: number): UIImage;
declare function copyLayerProperties(view: UIView, toView: UIView, customProperties?: {
view?: Array<keyof UIView>;
layer?: Array<keyof CALayer>;
}): void;
declare function animateWithSpring(options?: {
tension?: number;
friction?: number;
mass?: number;
delay?: number;
velocity?: number;
animateOptions?: UIViewAnimationOptions;
animations?: () => void;
completion?: (finished?: boolean) => void;
}): void;
export declare const ad: {
resources: {
getDrawableId: (name: any) => number;
getStringId: (name: any) => number;
getId: (name: string) => number;
getResource: (name: string, type?: string) => number;
getPaletteColor: (name: string, context: android.content.Context) => number;
};
collections: {
stringArrayToStringSet(str: string[]): java.util.HashSet<string>;
stringSetToStringArray(stringSet: any): string[];
};
getWindow: () => android.view.Window;
getApplication: () => android.app.Application;
getCurrentActivity: () => androidx.appcompat.app.AppCompatActivity | android.app.Activity | null;
getApplicationContext: () => android.content.Context;
getResources: () => android.content.res.Resources;
getPackageName: () => string;
getInputMethodManager: () => android.view.inputmethod.InputMethodManager;
showSoftInput: (nativeView: android.view.View) => void;
dismissSoftInput: (nativeView?: android.view.View) => void;
setDarkModeHandler(options?: {
activity?: androidx.appcompat.app.AppCompatActivity;
handler: (bar: "status" | "navigation", resources: android.content.res.Resources) => boolean;
}): void;
setNavigationBarColor(options?: {
activity?: androidx.appcompat.app.AppCompatActivity;
lightColor?: Color;
darkColor?: Color;
}): void;
setStatusBarColor(options?: {
activity?: androidx.appcompat.app.AppCompatActivity;
lightColor?: Color;
darkColor?: Color;
}): void;
enableEdgeToEdge(activityOrWindow: androidx.activity.ComponentActivity, options?: {
statusBarLightColor?: Color;
statusBarDarkColor?: Color;
navigationBarLightColor?: Color;
navigationBarDarkColor?: Color;
handleDarkMode?: (bar: "status" | "navigation", resources: android.content.res.Resources) => boolean;
}): void;
enableEdgeToEdge(activity: androidx.activity.ComponentActivity, window: android.view.Window, options?: {
statusBarLightColor?: Color;
statusBarDarkColor?: Color;
navigationBarLightColor?: Color;
navigationBarDarkColor?: Color;
handleDarkMode?: (bar: "status" | "navigation", resources: android.content.res.Resources) => boolean;
}): void;
getIgnoreEdgeToEdgeOnOlderDevices(): boolean;
setIgnoreEdgeToEdgeOnOlderDevices(value: boolean): void;
};
export declare const android: {
resources: {
getDrawableId: (name: any) => number;
getStringId: (name: any) => number;
getId: (name: string) => number;
getResource: (name: string, type?: string) => number;
getPaletteColor: (name: string, context: android.content.Context) => number;
};
collections: {
stringArrayToStringSet(str: string[]): java.util.HashSet<string>;
stringSetToStringArray(stringSet: any): string[];
};
getWindow: () => android.view.Window;
getApplication: () => android.app.Application;
getCurrentActivity: () => androidx.appcompat.app.AppCompatActivity | android.app.Activity | null;
getApplicationContext: () => android.content.Context;
getResources: () => android.content.res.Resources;
getPackageName: () => string;
getInputMethodManager: () => android.view.inputmethod.InputMethodManager;
showSoftInput: (nativeView: android.view.View) => void;
dismissSoftInput: (nativeView?: android.view.View) => void;
setDarkModeHandler(options?: {
activity?: androidx.appcompat.app.AppCompatActivity;
handler: (bar: "status" | "navigation", resources: android.content.res.Resources) => boolean;
}): void;
setNavigationBarColor(options?: {
activity?: androidx.appcompat.app.AppCompatActivity;
lightColor?: Color;
darkColor?: Color;
}): void;
setStatusBarColor(options?: {
activity?: androidx.appcompat.app.AppCompatActivity;
lightColor?: Color;
darkColor?: Color;
}): void;
enableEdgeToEdge(activityOrWindow: androidx.activity.ComponentActivity, options?: {
statusBarLightColor?: Color;
statusBarDarkColor?: Color;
navigationBarLightColor?: Color;
navigationBarDarkColor?: Color;
handleDarkMode?: (bar: "status" | "navigation", resources: android.content.res.Resources) => boolean;
}): void;
enableEdgeToEdge(activity: androidx.activity.ComponentActivity, window: android.view.Window, options?: {
statusBarLightColor?: Color;
statusBarDarkColor?: Color;
navigationBarLightColor?: Color;
navigationBarDarkColor?: Color;
handleDarkMode?: (bar: "status" | "navigation", resources: android.content.res.Resources) => boolean;
}): void;
getIgnoreEdgeToEdgeOnOlderDevices(): boolean;
setIgnoreEdgeToEdgeOnOlderDevices(value: boolean): void;
};
export declare const ios: {
collections: typeof collections;
createUIDocumentInteractionControllerDelegate: typeof createUIDocumentInteractionControllerDelegate;
getCurrentAppPath: typeof getCurrentAppPath;
getRootViewController: typeof getRootViewController;
getVisibleViewController: typeof getVisibleViewController;
getWindow: typeof getWindow;
getMainScreen: typeof getMainScreen;
setWindowBackgroundColor: typeof setWindowBackgroundColor;
isLandscape: typeof isLandscape;
applyRotateTransform: typeof applyRotateTransform;
snapshotView: typeof snapshotView;
joinPaths: typeof joinPaths;
printCGRect: typeof printCGRect;
copyLayerProperties: typeof copyLayerProperties;
animateWithSpring: typeof animateWithSpring;
MajorVersion: number;
};
/**
* @deprecated Use `Utils.ios` instead.
*/
export declare const iOSNativeHelper: {
collections: typeof collections;
createUIDocumentInteractionControllerDelegate: typeof createUIDocumentInteractionControllerDelegate;
getCurrentAppPath: typeof getCurrentAppPath;
getRootViewController: typeof getRootViewController;
getVisibleViewController: typeof getVisibleViewController;
getWindow: typeof getWindow;
getMainScreen: typeof getMainScreen;
setWindowBackgroundColor: typeof setWindowBackgroundColor;
isLandscape: typeof isLandscape;
applyRotateTransform: typeof applyRotateTransform;
snapshotView: typeof snapshotView;
joinPaths: typeof joinPaths;
printCGRect: typeof printCGRect;
copyLayerProperties: typeof copyLayerProperties;
animateWithSpring: typeof animateWithSpring;
MajorVersion: number;
};
export {};