mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-22 13:32:54 +08:00
fix(tabs): select returns boolean
This commit is contained in:
@ -1365,13 +1365,13 @@ export function updateTab(nav: Nav, component: any, data: any, escapeHatch: Esca
|
||||
// yeah yeah, I know this is kind of ugly but oh well, I know the internal structure of <ion-tabs>
|
||||
const tabs = tab.parentElement.parentElement as HTMLIonTabsElement;
|
||||
|
||||
return isTabSelected(tabs, tab).then((isSelected: boolean) => {
|
||||
return isTabSelected(tabs, tab).then((isSelected) => {
|
||||
if (!isSelected) {
|
||||
const promise = updateNav(nav, component, data, escapeHatch, isTopLevel);
|
||||
const app = document.querySelector('ion-app');
|
||||
return app.componentOnReady().then(() => {
|
||||
app.setExternalNavPromise(promise);
|
||||
}).then(() => {
|
||||
|
||||
// okay, the tab is not selected, so we need to do a "switch" transition
|
||||
// basically, we should update the nav, and then swap the tabs
|
||||
return promise.then((navResult) => {
|
||||
|
@ -122,18 +122,19 @@ export class Tabs implements NavOutlet {
|
||||
|
||||
const leavingTab = this.selectedTab;
|
||||
|
||||
return selectedTab.setActive()
|
||||
.then(() => {
|
||||
selectedTab.selected = true;
|
||||
if (leavingTab && leavingTab !== selectedTab) {
|
||||
return selectedTab.setActive().then(() => {
|
||||
selectedTab.selected = true;
|
||||
if (leavingTab !== selectedTab) {
|
||||
if (leavingTab) {
|
||||
leavingTab.active = false;
|
||||
this.selectedTab = selectedTab;
|
||||
this.ionChange.emit(selectedTab);
|
||||
this.ionNavChanged.emit({isPop: false});
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
this.selectedTab = selectedTab;
|
||||
this.ionChange.emit(selectedTab);
|
||||
this.ionNavChanged.emit({isPop: false});
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user