Skip to content

Commit

Permalink
fix(tabs): emit viewDidEnter and viewDidLeave on app during tab change
Browse files Browse the repository at this point in the history
  • Loading branch information
mlynch committed Oct 10, 2017
1 parent c4e9b5d commit c8be8e2
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/components/tabs/tabs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -452,8 +452,15 @@ export class Tabs extends Ion implements AfterViewInit, RootNode, ITabs, Navigat
}

// Fire didEnter/didLeave lifecycle events
selectedPage && selectedPage._didEnter();
currentPage && currentPage._didLeave();
if (selectedPage) {
selectedPage._didEnter();
this._app.viewDidEnter.emit(selectedPage);
}

if (currentPage) {
currentPage && currentPage._didLeave();

This comment has been minimized.

Copy link
@manucorporat

manucorporat Oct 12, 2017

Contributor

@mlynch no need to have:

currentPage &&

since we know for sure currentPage is non-null inside the if statement

This comment has been minimized.

Copy link
@manucorporat

manucorporat Oct 12, 2017

Contributor

also, we probably also want to fire this._app.viewWillEnter and this._app.viewWillLeave

this._app.viewDidLeave.emit(currentPage);
}

// track the order of which tabs have been selected, by their index
// do not track if the tab index is the same as the previous
Expand Down

0 comments on commit c8be8e2

Please sign in to comment.