Skip to content

Commit

Permalink
feat(actionsheet): add ActionSheetOptions interface
Browse files Browse the repository at this point in the history
  • Loading branch information
ihadeed committed Dec 4, 2016
1 parent c1398eb commit f211da7
Showing 1 changed file with 39 additions and 28 deletions.
67 changes: 39 additions & 28 deletions src/plugins/actionsheet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import { Cordova, Plugin } from './plugin';
* ```typescript
* import { ActionSheet } from 'ionic-native';
*
*
* let buttonLabels = ['Share via Facebook', 'Share via Twitter'];
* ActionSheet.show({
* 'title': 'What do you want with this image?',
Expand All @@ -23,22 +22,8 @@ import { Cordova, Plugin } from './plugin';
* console.log('Button pressed: ' + buttonIndex);
* });
* ```
*
* @advanced
* 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 |
*
*
* @interfaces
* ActionSheetOptions
*/
@Plugin({
pluginName: 'ActionSheet',
Expand All @@ -51,21 +36,12 @@ export class ActionSheet {

/**
* 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
* button pressed (1 based, so 1, 2, 3, etc.)
*/
@Cordova()
static show(options?: {
buttonLabels: string[],
title?: string,
androidTheme?: number,
androidEnableCancelButton?: boolean,
winphoneEnableCancelButton?: boolean,
addCancelButtonWithLabel?: string,
addDestructiveButtonWithLabel?: string,
position?: number[]
}): Promise<any> { return; }
static show(options?: ActionSheetOptions): Promise<any> { return; }


/**
Expand All @@ -76,3 +52,38 @@ export class ActionSheet {
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[];
}

0 comments on commit f211da7

Please sign in to comment.