UNPKG

9.3 kBTypeScriptView Raw
1/**
2 * Data serialization from JS > Native
3 * @param wrapPrimitives Optionally wrap primitive types (Some APIs may require this)
4 */
5export function dataSerialize(data?: any, wrapPrimitives?: boolean): any;
6/**
7 * Data deserialization from Native > JS
8 * @param nativeData Native platform data
9 */
10export function dataDeserialize(nativeData?: any): any;
11
12// /**
13// * Module with android specific utilities.
14// */
15// declare namespace AndroidUtils {
16// /**
17// * Gets the native Android application instance.
18// */
19// export function getApplication(): any; /* android.app.Application */
20
21// /**
22// * Get the current native Android activity.
23// */
24// export function getCurrentActivity(): any; /* android.app.Activity */
25// /**
26// * Gets the native Android application resources.
27// */
28// export function getResources(): any; /* android.content.res.Resources */
29
30// /**
31// * Gets the Android application context.
32// */
33// export function getApplicationContext(): any; /* android.content.Context */
34
35// /**
36// * Gets the native Android input method manager.
37// */
38// export function getInputMethodManager(): any; /* android.view.inputmethod.InputMethodManager */
39
40// /**
41// * Hides the soft input method, usually a soft keyboard.
42// */
43// export function dismissSoftInput(nativeView?: any /* android.view.View */): void;
44
45// /**
46// * Shows the soft input method, usually a soft keyboard.
47// */
48// export function showSoftInput(nativeView: any /* android.view.View */): void;
49
50// /**
51// * Utility module dealing with some android collections.
52// */
53// namespace collections {
54// /**
55// * Converts string array into a String [hash set](http://developer.android.com/reference/java/util/HashSet.html).
56// * @param str - An array of strings to convert.
57// */
58// export function stringArrayToStringSet(str: string[]): any;
59
60// /**
61// * Converts string hash set into array of strings.
62// * @param stringSet - A string hash set to convert.
63// */
64// export function stringSetToStringArray(stringSet: any): string[];
65// }
66
67// /**
68// * Utility module related to android resources.
69// */
70// export namespace resources {
71// /**
72// * Gets the drawable id from a given name.
73// * @param name - Name of the resource.
74// */
75// export function getDrawableId(name);
76
77// /**
78// * Gets the string id from a given name.
79// * @param name - Name of the resource.
80// */
81// export function getStringId(name);
82
83// /**
84// * Gets the id from a given name.
85// * @param name - Name of the resource.
86// */
87// export function getId(name: string): number;
88
89// /**
90// * Gets the id from a given name with optional type.
91// * This sets an explicit package name.
92// * https://developer.android.com/reference/android/content/res/Resources#getIdentifier(java.lang.String,%20java.lang.String,%20java.lang.String)
93// * @param name - Name of the resource.
94// * @param type - (Optional) type
95// */
96// export function getResource(name: string, type?: string): number;
97
98// /**
99// * [Obsolete - please use getPaletteColor] Gets a color from current theme.
100// * @param name - Name of the color
101// */
102// export function getPalleteColor();
103
104// /**
105// * Gets a color from the current theme.
106// * @param name - Name of the color resource.
107// */
108// export function getPaletteColor(name: string, context: any /* android.content.Context */): number;
109// }
110
111// /**
112// * Checks whether the application is running on real device and not on emulator.
113// */
114// export function isRealDevice(): boolean;
115// }
116
117// /**
118// * Module with ios specific utilities.
119// */
120// declare namespace iOSUtils {
121// // Common properties between UILabel, UITextView and UITextField
122// export interface TextUIView {
123// font: any;
124// textAlignment: number;
125// textColor: any;
126// text: string;
127// attributedText: any;
128// lineBreakMode: number;
129// numberOfLines: number;
130// }
131
132// /**
133// * Utility module dealing with some iOS collections.
134// */
135// export namespace collections {
136// /**
137// * Converts JavaScript array to [NSArray](https://developer.apple.com/library/ios/documentation/Cocoa/Reference/Foundation/Classes/NSArray_Class/).
138// * @param str - JavaScript string array to convert.
139// */
140// export function jsArrayToNSArray<T>(str: T[]): NSArray<T>;
141
142// /**
143// * Converts NSArray to JavaScript array.
144// * @param a - NSArray to convert.
145// */
146// export function nsArrayToJSArray<T>(a: NSArray<T>): T[];
147// }
148
149// /**
150// * Get the root UIViewController of the app
151// */
152// export function getRootViewController(): any; /* UIViewController */
153
154// /**
155// * Get the UIWindow of the app
156// */
157// export function getWindow(): any; /* UIWindow */
158
159// /**
160// * Set the window background color of base view of the app.
161// * Often this is shown when opening a modal as the view underneath scales down revealing the window color.
162// * @param value color (hex, rgb, rgba, etc.)
163// */
164// export function setWindowBackgroundColor(value: string): void;
165
166// /**
167// * Data serialize and deserialize helpers
168// */
169// export function dataSerialize(data?: any): any;
170// export function dataDeserialize(nativeData?: any): any;
171
172// /**
173// * @deprecated use application.orientation instead
174// *
175// * Gets an information about if current mode is Landscape.
176// */
177// export function isLandscape(): boolean;
178
179// /**
180// * Gets the iOS device major version (for 8.1 will return 8).
181// */
182// export const MajorVersion: number;
183
184// /**
185// * Opens file with associated application.
186// * @param filePath The file path.
187// */
188// export function openFile(filePath: string): boolean;
189
190// /**
191// * Joins an array of file paths.
192// * @param paths An array of paths.
193// * Returns the joined path.
194// */
195// export function joinPaths(...paths: string[]): string;
196
197// /**
198// * Gets the root folder for the current application. This Folder is private for the application and not accessible from Users/External apps.
199// * iOS - this folder is read-only and contains the app and all its resources.
200// */
201// export function getCurrentAppPath(): string;
202
203// /**
204// * Gets the currently visible(topmost) UIViewController.
205// * @param rootViewController The root UIViewController instance to start searching from (normally window.rootViewController).
206// * Returns the visible UIViewController.
207// */
208// export function getVisibleViewController(rootViewController: any /* UIViewController*/): any; /* UIViewController*/
209
210// /**
211// *
212// * @param transform Applies a rotation transform over X,Y and Z axis
213// * @param x Rotation over X axis in degrees
214// * @param y Rotation over Y axis in degrees
215// * @param z Rotation over Z axis in degrees
216// */
217// export function applyRotateTransform(transform: any /* CATransform3D*/, x: number, y: number, z: number): any; /* CATransform3D*/
218
219// /**
220// * Create a UIDocumentInteractionControllerDelegate implementation for use with UIDocumentInteractionController
221// */
222// export function createUIDocumentInteractionControllerDelegate(): any;
223
224// /**
225// * Checks whether the application is running on real device and not on simulator.
226// */
227// export function isRealDevice(): boolean;
228
229// /**
230// * Debug utility to insert CGRect values into logging output.
231// * Note: when printing a CGRect directly it will print blank so this helps show the values.
232// * @param rect CGRect
233// */
234// export function printCGRect(rect: CGRect): void;
235
236// /**
237// * Take a snapshot of a View on screen.
238// * @param view view to snapshot
239// * @param scale screen scale
240// */
241// export function snapshotView(view: UIView, scale: number): UIImage;
242
243// /**
244// * Copy layer properties from one view to another.
245// * @param view a view to copy layer properties to
246// * @param toView a view to copy later properties from
247// * @param (optional) custom properties to copy between both views
248// */
249// export function copyLayerProperties(view: UIView, toView: UIView, customProperties?: { view?: Array<string> /* Array<keyof UIView> */; layer?: Array<string> /* Array<keyof CALayer> */ }): void;
250
251// /**
252// * Animate views with a configurable spring effect
253// * @param options various animation settings for the spring
254// * - tension: number
255// * - friction: number
256// * - mass: number
257// * - delay: number
258// * - velocity: number
259// * - animateOptions: UIViewAnimationOptions
260// * - animations: () => void, Callback containing the property changes you want animated
261// * - completion: (finished: boolean) => void, Callback when animation is finished
262// */
263// export function animateWithSpring(options?: { tension?: number; friction?: number; mass?: number; delay?: number; velocity?: number; animateOptions?: UIViewAnimationOptions; animations?: () => void; completion?: (finished?: boolean) => void });
264// }
265
266import * as AndroidUtils from './android';
267export import android = AndroidUtils;
268
269/**
270 * @deprecated use Utils.android instead.
271 */
272export import ad = AndroidUtils;
273
274import * as iOSUtils from './ios';
275export import ios = iOSUtils;
276
277/**
278 * @deprecated use Utils.ios instead.
279 */
280export import iOSNativeHelper = iOSUtils;