UNPKG

2.21 kBTypeScriptView Raw
1export interface ActionSheetOptions {
2 /**
3 * The labels for the buttons. Uses the index x
4 */
5 buttonLabels: string[];
6 /**
7 * The title for the actionsheet
8 */
9 title?: string;
10 /**
11 * Theme to be used on Android
12 */
13 androidTheme?: number;
14 /**
15 * Enable a cancel on Android
16 */
17 androidEnableCancelButton?: boolean;
18 /**
19 * Enable a cancel on Windows Phone
20 */
21 winphoneEnableCancelButton?: boolean;
22 /**
23 * Add a cancel button with text
24 */
25 addCancelButtonWithLabel?: string;
26 /**
27 * Add a destructive button with text
28 */
29 addDestructiveButtonWithLabel?: string;
30 /**
31 * On an iPad, set the X,Y position
32 */
33 position?: number[];
34}
35/**
36 * @name Action Sheet
37 * @description
38 * The ActionSheet plugin shows a native list of options the user can choose from.
39 *
40 * Requires Cordova plugin: `cordova-plugin-actionsheet`. For more info, please see the [ActionSheet plugin docs](https://github.com/EddyVerbruggen/cordova-plugin-actionsheet).
41 *
42 * @usage
43 * ```typescript
44 * import { ActionSheet } from 'ionic-native';
45 *
46 * let buttonLabels = ['Share via Facebook', 'Share via Twitter'];
47 * ActionSheet.show({
48 * 'title': 'What do you want with this image?',
49 * 'buttonLabels': buttonLabels,
50 * 'addCancelButtonWithLabel': 'Cancel',
51 * 'addDestructiveButtonWithLabel' : 'Delete'
52 * }).then((buttonIndex: number) => {
53 * console.log('Button pressed: ' + buttonIndex);
54 * });
55 * ```
56 * @interfaces
57 * ActionSheetOptions
58 */
59export declare class ActionSheet {
60 /**
61 * Show a native ActionSheet component. See below for options.
62 * @param options {ActionSheetOptions} Options See table below
63 * @returns {Promise<any>} Returns a Promise that resolves with the index of the
64 * button pressed (1 based, so 1, 2, 3, etc.)
65 */
66 static show(options?: ActionSheetOptions): Promise<any>;
67 /**
68 * Progamtically hide the native ActionSheet
69 * @returns {Promise<any>} Returns a Promise that resolves when the actionsheet is closed
70 */
71 static hide(options?: any): Promise<any>;
72}