Skip to content

Commit

Permalink
fix(tabs): regression in nav-controller-base
Browse files Browse the repository at this point in the history
  • Loading branch information
manucorporat committed Oct 18, 2016
1 parent 5ad4c54 commit d84d8a6
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/components/item/test/sliding/main.html
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ <h2>HubStruck Notifications</h2>
</a>

<ion-item-options side="left">
<button ion-button icon-only (click)="noclose(item100)">
<button ion-button (click)="noclose(item100)">
No close
</button>
</ion-item-options>
Expand Down
20 changes: 11 additions & 9 deletions src/navigation/nav-controller-base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -521,6 +521,14 @@ export class NavControllerBase extends Ion implements NavController {
this._sbTrns = transition;
}

// transition start has to be registered before attaching the view to the DOM!
transition.registerStart(() => {
this._trnsStart(transition, enteringView, leavingView, opts, resolve);
if (transition.parent) {
transition.parent.start();
}
});

if (enteringView && enteringView._state === ViewState.INITIALIZED) {
// render the entering component in the DOM
// this would also render new child navs/views
Expand All @@ -531,13 +539,6 @@ export class NavControllerBase extends Ion implements NavController {
console.debug('enteringView state is not INITIALIZED', enteringView);
}

transition.registerStart(() => {
this._trnsStart(transition, enteringView, leavingView, opts, resolve);
if (transition.parent) {
transition.parent.start();
}
});

if (!transition.hasChildren) {
// lowest level transition, so kick it off and let it bubble up to start all of them
transition.start();
Expand Down Expand Up @@ -633,8 +634,9 @@ export class NavControllerBase extends Ion implements NavController {
// mainly for testing
let enteringName: string;
let leavingName: string;
let hasCompleted = transition.hasCompleted;

if (transition.hasCompleted) {
if (hasCompleted) {
// transition has completed (went from 0 to 1)
if (transition.enteringView) {
enteringName = transition.enteringView.name;
Expand Down Expand Up @@ -671,7 +673,7 @@ export class NavControllerBase extends Ion implements NavController {
}

// congrats, we did it!
resolve(transition.hasCompleted, true, enteringName, leavingName, opts.direction);
resolve(hasCompleted, true, enteringName, leavingName, opts.direction);
}

_insertViewAt(view: ViewController, index: number) {
Expand Down
4 changes: 3 additions & 1 deletion src/util/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,11 +156,13 @@ export function reorderArray(array: any[], indexes: {from: number, to: number}):
return array;
}


const ASSERT_ENABLED = true;
/**
* @private
*/
function _assert(actual: any, reason?: string) {
if (!actual) {
if (!actual && ASSERT_ENABLED === true) {
let message = 'IONIC ASSERT: ' + reason;
console.error(message);
throw new Error(message);
Expand Down

0 comments on commit d84d8a6

Please sign in to comment.