From d0c5f53a089892234f6001e36262cbb3bc3447a4 Mon Sep 17 00:00:00 2001 From: "Manu Mtz.-Almeida" Date: Mon, 26 Mar 2018 23:09:43 +0200 Subject: [PATCH] fix(button): dynamic bar-button --- core/src/components/button/button.tsx | 8 +++++++- core/src/components/toolbar/toolbar.tsx | 7 ------- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/core/src/components/button/button.tsx b/core/src/components/button/button.tsx index 233304bc26..ea992af7b5 100644 --- a/core/src/components/button/button.tsx +++ b/core/src/components/button/button.tsx @@ -33,7 +33,7 @@ export class Button { * The type of button. * Possible values are: `"button"`, `"bar-button"`. */ - @Prop() buttonType = 'button'; + @Prop({mutable: true}) buttonType = 'button'; /** * The button size. @@ -93,6 +93,12 @@ export class Button { */ @Event() ionBlur: EventEmitter; + componentWillLoad() { + if (this.el.closest('ion-buttons')) { + this.buttonType = 'bar-button'; + } + } + onFocus() { this.ionFocus.emit(); } diff --git a/core/src/components/toolbar/toolbar.tsx b/core/src/components/toolbar/toolbar.tsx index e2a5877c53..960ffa586f 100644 --- a/core/src/components/toolbar/toolbar.tsx +++ b/core/src/components/toolbar/toolbar.tsx @@ -40,13 +40,6 @@ export class Toolbar { */ @Prop() translucent = false; - componentDidLoad() { - const buttons = this.el.querySelectorAll('ion-button'); - for (let i = 0; i < buttons.length; i++) { - buttons[i].buttonType = 'bar-button'; - } - } - hostData() { const themedClasses = this.translucent ? createThemedClasses(this.mode, this.color, 'toolbar-translucent') : {};