fix(tabs): initialize select in the willLoad before the select call is made (#18300)

#17957
This commit is contained in:
Brandy Carney
2019-05-20 11:26:46 -04:00
committed by GitHub
parent fa87e35a05
commit da38647478

View File

@ -49,14 +49,11 @@ export class Tabs implements NavOutlet {
this.useRouter = !!this.doc.querySelector('ion-router') && !this.el.closest('[no-router]');
}
this.tabs = Array.from(this.el.querySelectorAll('ion-tab'));
await this.initSelect();
this.ionNavWillLoad.emit();
this.componentWillUpdate();
}
componentDidLoad() {
this.initSelect();
}
componentDidUnload() {
this.tabs.length = 0;
this.selectedTab = this.leavingTab = undefined;
@ -156,6 +153,7 @@ export class Tabs implements NavOutlet {
}
// wait for all tabs to be ready
await Promise.all(this.tabs.map(tab => tab.componentOnReady()));
await this.select(this.tabs[0]);
}