From 9e63947e3c1a14b3b4e60c592a0d055d21592afe Mon Sep 17 00:00:00 2001 From: Brandy Carney Date: Wed, 17 Apr 2019 12:55:51 -0400 Subject: [PATCH 1/3] fix(action-sheet): default buttons to empty array fixes an error with the timing of the buttons being added --- core/api.txt | 2 +- core/src/components.d.ts | 2 +- .../components/action-sheet/action-sheet.tsx | 2 +- core/src/components/action-sheet/readme.md | 26 +++++++++---------- core/src/utils/test/modes/index.html | 3 +++ 5 files changed, 19 insertions(+), 16 deletions(-) diff --git a/core/api.txt b/core/api.txt index fa25ac3c32..d56fd0ed5a 100644 --- a/core/api.txt +++ b/core/api.txt @@ -7,7 +7,7 @@ ion-action-sheet-controller,method,getTop,getTop() => Promise Promise) | undefined,undefined,false,false ion-action-sheet,prop,header,string | undefined,undefined,false,false diff --git a/core/src/components.d.ts b/core/src/components.d.ts index 89660ce0bb..7a1b044b4c 100644 --- a/core/src/components.d.ts +++ b/core/src/components.d.ts @@ -176,7 +176,7 @@ export namespace Components { /** * An array of buttons for the action sheet. */ - 'buttons': (ActionSheetButton | string)[]; + 'buttons'?: (ActionSheetButton | string)[]; /** * Additional classes to apply for custom CSS. If multiple classes are provided they should be separated by spaces. */ diff --git a/core/src/components/action-sheet/action-sheet.tsx b/core/src/components/action-sheet/action-sheet.tsx index bb90ea59c4..303ffb8e4b 100644 --- a/core/src/components/action-sheet/action-sheet.tsx +++ b/core/src/components/action-sheet/action-sheet.tsx @@ -51,7 +51,7 @@ export class ActionSheet implements ComponentInterface, OverlayInterface { /** * An array of buttons for the action sheet. */ - @Prop() buttons!: (ActionSheetButton | string)[]; + @Prop() buttons: (ActionSheetButton | string)[] = []; /** * Additional classes to apply for custom CSS. If multiple classes are diff --git a/core/src/components/action-sheet/readme.md b/core/src/components/action-sheet/readme.md index 7e107d75f0..2920b496db 100644 --- a/core/src/components/action-sheet/readme.md +++ b/core/src/components/action-sheet/readme.md @@ -257,19 +257,19 @@ export default { ## Properties -| Property | Attribute | Description | Type | Default | -| ---------------------- | ------------------ | ------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | ----------- | -| `animated` | `animated` | If `true`, the action sheet will animate. | `boolean` | `true` | -| `backdropDismiss` | `backdrop-dismiss` | If `true`, the action sheet will be dismissed when the backdrop is clicked. | `boolean` | `true` | -| `buttons` _(required)_ | -- | An array of buttons for the action sheet. | `(string \| ActionSheetButton)[]` | `undefined` | -| `cssClass` | `css-class` | Additional classes to apply for custom CSS. If multiple classes are provided they should be separated by spaces. | `string \| string[] \| undefined` | `undefined` | -| `enterAnimation` | -- | Animation to use when the action sheet is presented. | `((Animation: Animation, baseEl: any, opts?: any) => Promise) \| undefined` | `undefined` | -| `header` | `header` | Title for the action sheet. | `string \| undefined` | `undefined` | -| `keyboardClose` | `keyboard-close` | If `true`, the keyboard will be automatically dismissed when the overlay is presented. | `boolean` | `true` | -| `leaveAnimation` | -- | Animation to use when the action sheet is dismissed. | `((Animation: Animation, baseEl: any, opts?: any) => Promise) \| undefined` | `undefined` | -| `mode` | `mode` | The mode determines which platform styles to use. | `"ios" \| "md"` | `undefined` | -| `subHeader` | `sub-header` | Subtitle for the action sheet. | `string \| undefined` | `undefined` | -| `translucent` | `translucent` | If `true`, the action sheet will be translucent. Only applies when the mode is `"ios"` and the device supports backdrop-filter. | `boolean` | `false` | +| Property | Attribute | Description | Type | Default | +| ----------------- | ------------------ | ------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | ----------- | +| `animated` | `animated` | If `true`, the action sheet will animate. | `boolean` | `true` | +| `backdropDismiss` | `backdrop-dismiss` | If `true`, the action sheet will be dismissed when the backdrop is clicked. | `boolean` | `true` | +| `buttons` | -- | An array of buttons for the action sheet. | `(string \| ActionSheetButton)[]` | `[]` | +| `cssClass` | `css-class` | Additional classes to apply for custom CSS. If multiple classes are provided they should be separated by spaces. | `string \| string[] \| undefined` | `undefined` | +| `enterAnimation` | -- | Animation to use when the action sheet is presented. | `((Animation: Animation, baseEl: any, opts?: any) => Promise) \| undefined` | `undefined` | +| `header` | `header` | Title for the action sheet. | `string \| undefined` | `undefined` | +| `keyboardClose` | `keyboard-close` | If `true`, the keyboard will be automatically dismissed when the overlay is presented. | `boolean` | `true` | +| `leaveAnimation` | -- | Animation to use when the action sheet is dismissed. | `((Animation: Animation, baseEl: any, opts?: any) => Promise) \| undefined` | `undefined` | +| `mode` | `mode` | The mode determines which platform styles to use. | `"ios" \| "md"` | `undefined` | +| `subHeader` | `sub-header` | Subtitle for the action sheet. | `string \| undefined` | `undefined` | +| `translucent` | `translucent` | If `true`, the action sheet will be translucent. Only applies when the mode is `"ios"` and the device supports backdrop-filter. | `boolean` | `false` | ## Events diff --git a/core/src/utils/test/modes/index.html b/core/src/utils/test/modes/index.html index b9262540e3..7637fcfb5e 100644 --- a/core/src/utils/test/modes/index.html +++ b/core/src/utils/test/modes/index.html @@ -113,6 +113,7 @@