mirror of
https://github.com/danielsogl/awesome-cordova-plugins.git
synced 2026-05-02 00:07:23 +08:00
feat(actionsheet): add ActionSheetOptions interface
This commit is contained in:
+39
-28
@@ -12,7 +12,6 @@ import { Cordova, Plugin } from './plugin';
|
|||||||
* ```typescript
|
* ```typescript
|
||||||
* import { ActionSheet } from 'ionic-native';
|
* import { ActionSheet } from 'ionic-native';
|
||||||
*
|
*
|
||||||
*
|
|
||||||
* let buttonLabels = ['Share via Facebook', 'Share via Twitter'];
|
* let buttonLabels = ['Share via Facebook', 'Share via Twitter'];
|
||||||
* ActionSheet.show({
|
* ActionSheet.show({
|
||||||
* 'title': 'What do you want with this image?',
|
* 'title': 'What do you want with this image?',
|
||||||
@@ -23,22 +22,8 @@ import { Cordova, Plugin } from './plugin';
|
|||||||
* console.log('Button pressed: ' + buttonIndex);
|
* console.log('Button pressed: ' + buttonIndex);
|
||||||
* });
|
* });
|
||||||
* ```
|
* ```
|
||||||
*
|
* @interfaces
|
||||||
* @advanced
|
* ActionSheetOptions
|
||||||
* ActionSheet options
|
|
||||||
*
|
|
||||||
* | Option | Type | Description |
|
|
||||||
* |-------------------------------|-----------|----------------------------------------------|
|
|
||||||
* | title |`string` | The title for the actionsheet |
|
|
||||||
* | buttonLabels |`string[]` | the labels for the buttons. Uses the index x |
|
|
||||||
* | androidTheme |`number` | Theme to be used on Android |
|
|
||||||
* | androidEnableCancelButton |`boolean` | Enable a cancel on Android |
|
|
||||||
* | winphoneEnableCancelButton |`boolean` | Enable a cancel on Windows Phone |
|
|
||||||
* | addCancelButtonWithLabel |`string` | Add a cancel button with text |
|
|
||||||
* | addDestructiveButtonWithLabel |`string` | Add a destructive button with text |
|
|
||||||
* | position |`number[]` | On an iPad, set the X,Y position |
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
@Plugin({
|
@Plugin({
|
||||||
pluginName: 'ActionSheet',
|
pluginName: 'ActionSheet',
|
||||||
@@ -51,21 +36,12 @@ export class ActionSheet {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Show a native ActionSheet component. See below for options.
|
* Show a native ActionSheet component. See below for options.
|
||||||
* @param {options} Options See table below
|
* @param options {ActionSheetOptions} Options See table below
|
||||||
* @returns {Promise<any>} Returns a Promise that resolves with the index of the
|
* @returns {Promise<any>} Returns a Promise that resolves with the index of the
|
||||||
* button pressed (1 based, so 1, 2, 3, etc.)
|
* button pressed (1 based, so 1, 2, 3, etc.)
|
||||||
*/
|
*/
|
||||||
@Cordova()
|
@Cordova()
|
||||||
static show(options?: {
|
static show(options?: ActionSheetOptions): Promise<any> { return; }
|
||||||
buttonLabels: string[],
|
|
||||||
title?: string,
|
|
||||||
androidTheme?: number,
|
|
||||||
androidEnableCancelButton?: boolean,
|
|
||||||
winphoneEnableCancelButton?: boolean,
|
|
||||||
addCancelButtonWithLabel?: string,
|
|
||||||
addDestructiveButtonWithLabel?: string,
|
|
||||||
position?: number[]
|
|
||||||
}): Promise<any> { return; }
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -76,3 +52,38 @@ export class ActionSheet {
|
|||||||
static hide(options?: any): Promise<any> { return; }
|
static hide(options?: any): Promise<any> { return; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface ActionSheetOptions {
|
||||||
|
/**
|
||||||
|
* The labels for the buttons. Uses the index x
|
||||||
|
*/
|
||||||
|
buttonLabels: string[];
|
||||||
|
/**
|
||||||
|
* The title for the actionsheet
|
||||||
|
*/
|
||||||
|
title?: string;
|
||||||
|
/**
|
||||||
|
* Theme to be used on Android
|
||||||
|
*/
|
||||||
|
androidTheme?: number;
|
||||||
|
/**
|
||||||
|
* Enable a cancel on Android
|
||||||
|
*/
|
||||||
|
androidEnableCancelButton?: boolean;
|
||||||
|
/**
|
||||||
|
* Enable a cancel on Windows Phone
|
||||||
|
*/
|
||||||
|
winphoneEnableCancelButton?: boolean;
|
||||||
|
/**
|
||||||
|
* Add a cancel button with text
|
||||||
|
*/
|
||||||
|
addCancelButtonWithLabel?: string;
|
||||||
|
/**
|
||||||
|
* Add a destructive button with text
|
||||||
|
*/
|
||||||
|
addDestructiveButtonWithLabel?: string;
|
||||||
|
/**
|
||||||
|
* On an iPad, set the X,Y position
|
||||||
|
*/
|
||||||
|
position?: number[];
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user