Skip to content

Commit

Permalink
Merge branch 'fix-previousTab' of https://github.com/manucorporat/ionic
Browse files Browse the repository at this point in the history
# Conflicts:
#	src/components/tabs/tabs.ts
  • Loading branch information
manucorporat committed Jan 18, 2017
2 parents 4f711de + ba9e7b3 commit e770a9a
Showing 1 changed file with 22 additions and 26 deletions.
48 changes: 22 additions & 26 deletions src/components/tabs/tabs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -384,38 +384,34 @@ export class Tabs extends Ion implements AfterViewInit {
// it's possible the tab is only for opening modal's or signing out
// and doesn't actually have content. In the case there's no content
// for a tab then do nothing and leave the current view as is
if (!selectedTab.root) {
selectedTab.ionSelect.emit(selectedTab);
this.ionChange.emit(selectedTab);
return;
}

// At this point we are going to perform a page switch
// Let's fire willLeave in the current tab page
let currentPage: ViewController;
if (currentTab) {
currentPage = currentTab.getActive();
currentPage && currentPage._willLeave(false);
}
if (selectedTab.root) {
// At this point we are going to perform a page switch
// Let's fire willLeave in the current tab page
var currentPage: ViewController;
if (currentTab) {
currentPage = currentTab.getActive();
currentPage && currentPage._willLeave(false);
}

// Fire willEnter in the new selected tab
const selectedPage = selectedTab.getActive();
selectedPage && selectedPage._willEnter();
// Fire willEnter in the new selected tab
const selectedPage = selectedTab.getActive();
selectedPage && selectedPage._willEnter();

// Let's start the transition
opts.animate = false;
selectedTab.load(opts, () => {
this._tabSwitchEnd(selectedTab, selectedPage, currentPage);
if (opts.updateUrl !== false) {
this._linker.navChange(DIRECTION_SWITCH);
}
});
}
// Let's start the transition
opts.animate = false;
selectedTab.load(opts, () => {
this._tabSwitchEnd(selectedTab, selectedPage, currentPage);
if (opts.updateUrl !== false) {
this._linker.navChange(DIRECTION_SWITCH);
}
});
}

_tabSwitchEnd(selectedTab: Tab, selectedPage: ViewController, currentPage: ViewController) {
selectedTab.ionSelect.emit(selectedTab);
this.ionChange.emit(selectedTab);
}

_tabSwitchEnd(selectedTab: Tab, selectedPage: ViewController, currentPage: ViewController) {
// Update tabs selection state
const tabs = this._tabs;
let tab: Tab;
Expand Down

0 comments on commit e770a9a

Please sign in to comment.