Skip to content

Commit

Permalink
fix(nav): setRoot() and setPages() should not animate
Browse files Browse the repository at this point in the history
This commit also refactors both methods to avoid deduplicate code,
  • Loading branch information
manucorporat committed Sep 16, 2016
1 parent c1777c6 commit 7012734
Showing 1 changed file with 15 additions and 8 deletions.
23 changes: 15 additions & 8 deletions src/navigation/nav-controller-base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,19 +146,26 @@ export class NavControllerBase extends Ion implements NavController {
}

setRoot(pageOrViewCtrl: any, params?: any, opts?: NavOptions, done?: Function): Promise<any> {
return this._queueTrns({
insertStart: 0,
insertViews: [convertToView(this._linker, pageOrViewCtrl, params)],
removeStart: 0,
removeCount: -1,
opts: opts
}, done);
let viewControllers = [convertToView(this._linker, pageOrViewCtrl, params)];
return this._setPages(viewControllers, opts, done);
}

setPages(pages: any[], opts?: NavOptions, done?: Function): Promise<any> {
let viewControllers = convertToViews(this._linker, pages);
return this._setPages(viewControllers, opts, done);
}

_setPages(viewControllers: ViewController[], opts?: NavOptions, done?: Function): Promise<any> {
if (isBlank(opts)) {
opts = {};
}
// if animation wasn't set to true then default it to NOT animate
if (opts.animate !== true) {
opts.animate = false;
}
return this._queueTrns({
insertStart: 0,
insertViews: convertToViews(this._linker, pages),
insertViews: viewControllers,
removeStart: 0,
removeCount: -1,
opts: opts
Expand Down

0 comments on commit 7012734

Please sign in to comment.