refactor(toast): add deprecation warnings for showCloseButton and closeButtonText (#18955)

This commit is contained in:
Liam DeBeasi
2019-08-05 09:01:19 -04:00
committed by GitHub
parent 23f327ecb6
commit f9579bcd1d
3 changed files with 10 additions and 8 deletions

View File

@ -87,12 +87,12 @@ export class Toast implements ComponentInterface, OverlayInterface {
@Prop() position: 'top' | 'bottom' | 'middle' = 'bottom';
/**
* If `true`, the close button will be displayed.
* @deprecated Use `buttons` instead. If `true`, the close button will be displayed.
*/
@Prop() showCloseButton = false;
/**
* Text to display in the close button.
* @deprecated Use `buttons` instead. Text to display in the close button.
*/
@Prop() closeButtonText?: string;
@ -187,8 +187,10 @@ export class Toast implements ComponentInterface, OverlayInterface {
})
: [];
// tslint:disable-next-line: deprecation
if (this.showCloseButton) {
buttons.push({
// tslint:disable-next-line: deprecation
text: this.closeButtonText || 'Close',
handler: () => this.dismiss(undefined, 'cancel')
});