Skip to content

Commit 9e63947

Browse files
committed
fix(action-sheet): default buttons to empty array
fixes an error with the timing of the buttons being added
1 parent 0dd2f34 commit 9e63947

File tree

5 files changed

+19
-16
lines changed

5 files changed

+19
-16
lines changed

core/api.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ ion-action-sheet-controller,method,getTop,getTop() => Promise<HTMLIonActionSheet
77
ion-action-sheet,scoped
88
ion-action-sheet,prop,animated,boolean,true,false,false
99
ion-action-sheet,prop,backdropDismiss,boolean,true,false,false
10-
ion-action-sheet,prop,buttons,(string | ActionSheetButton)[],undefined,true,false
10+
ion-action-sheet,prop,buttons,(string | ActionSheetButton)[],[],false,false
1111
ion-action-sheet,prop,cssClass,string | string[] | undefined,undefined,false,false
1212
ion-action-sheet,prop,enterAnimation,((Animation: Animation, baseEl: any, opts?: any) => Promise<Animation>) | undefined,undefined,false,false
1313
ion-action-sheet,prop,header,string | undefined,undefined,false,false

core/src/components.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ export namespace Components {
176176
/**
177177
* An array of buttons for the action sheet.
178178
*/
179-
'buttons': (ActionSheetButton | string)[];
179+
'buttons'?: (ActionSheetButton | string)[];
180180
/**
181181
* Additional classes to apply for custom CSS. If multiple classes are provided they should be separated by spaces.
182182
*/

core/src/components/action-sheet/action-sheet.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ export class ActionSheet implements ComponentInterface, OverlayInterface {
5151
/**
5252
* An array of buttons for the action sheet.
5353
*/
54-
@Prop() buttons!: (ActionSheetButton | string)[];
54+
@Prop() buttons: (ActionSheetButton | string)[] = [];
5555

5656
/**
5757
* Additional classes to apply for custom CSS. If multiple classes are

core/src/components/action-sheet/readme.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -257,19 +257,19 @@ export default {
257257
258258
## Properties
259259
260-
| Property | Attribute | Description | Type | Default |
261-
| ---------------------- | ------------------ | ------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | ----------- |
262-
| `animated` | `animated` | If `true`, the action sheet will animate. | `boolean` | `true` |
263-
| `backdropDismiss` | `backdrop-dismiss` | If `true`, the action sheet will be dismissed when the backdrop is clicked. | `boolean` | `true` |
264-
| `buttons` _(required)_ | -- | An array of buttons for the action sheet. | `(string \| ActionSheetButton)[]` | `undefined` |
265-
| `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` |
266-
| `enterAnimation` | -- | Animation to use when the action sheet is presented. | `((Animation: Animation, baseEl: any, opts?: any) => Promise<Animation>) \| undefined` | `undefined` |
267-
| `header` | `header` | Title for the action sheet. | `string \| undefined` | `undefined` |
268-
| `keyboardClose` | `keyboard-close` | If `true`, the keyboard will be automatically dismissed when the overlay is presented. | `boolean` | `true` |
269-
| `leaveAnimation` | -- | Animation to use when the action sheet is dismissed. | `((Animation: Animation, baseEl: any, opts?: any) => Promise<Animation>) \| undefined` | `undefined` |
270-
| `mode` | `mode` | The mode determines which platform styles to use. | `"ios" \| "md"` | `undefined` |
271-
| `subHeader` | `sub-header` | Subtitle for the action sheet. | `string \| undefined` | `undefined` |
272-
| `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` |
260+
| Property | Attribute | Description | Type | Default |
261+
| ----------------- | ------------------ | ------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | ----------- |
262+
| `animated` | `animated` | If `true`, the action sheet will animate. | `boolean` | `true` |
263+
| `backdropDismiss` | `backdrop-dismiss` | If `true`, the action sheet will be dismissed when the backdrop is clicked. | `boolean` | `true` |
264+
| `buttons` | -- | An array of buttons for the action sheet. | `(string \| ActionSheetButton)[]` | `[]` |
265+
| `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` |
266+
| `enterAnimation` | -- | Animation to use when the action sheet is presented. | `((Animation: Animation, baseEl: any, opts?: any) => Promise<Animation>) \| undefined` | `undefined` |
267+
| `header` | `header` | Title for the action sheet. | `string \| undefined` | `undefined` |
268+
| `keyboardClose` | `keyboard-close` | If `true`, the keyboard will be automatically dismissed when the overlay is presented. | `boolean` | `true` |
269+
| `leaveAnimation` | -- | Animation to use when the action sheet is dismissed. | `((Animation: Animation, baseEl: any, opts?: any) => Promise<Animation>) \| undefined` | `undefined` |
270+
| `mode` | `mode` | The mode determines which platform styles to use. | `"ios" \| "md"` | `undefined` |
271+
| `subHeader` | `sub-header` | Subtitle for the action sheet. | `string \| undefined` | `undefined` |
272+
| `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` |
273273
274274
275275
## Events

core/src/utils/test/modes/index.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@
113113
<script>
114114
async function load() {
115115
const actionSheet = document.querySelector('ion-action-sheet');
116+
await actionSheet.componentOnReady();
116117

117118
actionSheet.buttons = [{
118119
text: 'Delete',
@@ -136,6 +137,8 @@
136137
}
137138
}];
138139

140+
await actionSheet.present();
141+
139142
const picker = document.querySelector('ion-picker');
140143
await picker.componentOnReady();
141144

0 commit comments

Comments
 (0)