Resolved issues #789, #1021, #1031.

This commit is contained in:
Rossen Hristov
2015-11-03 16:12:59 +02:00
parent 0ff96c72fd
commit e7c4209112
12 changed files with 179 additions and 34 deletions

View File

@ -300,10 +300,18 @@ class UINavigationControllerImpl extends UINavigationController implements UINav
return;
}
let newEntry: definition.BackstackEntry = viewController[ENTRY];
let newPage = newEntry.resolvedPage;
// For some reason iOS calls navigationControllerDidShowViewControllerAnimated twice for the
// main-page resulting in double 'loaded' and 'navigatedTo' events being fired.
if (!(<any>newPage)._delayLoadedEvent) {
return;
}
let backStack = frame.backStack;
let currentEntry = backStack.length > 0 ? backStack[backStack.length - 1] : null;
let newEntry: definition.BackstackEntry = viewController[ENTRY];
// This code check if navigation happened through UI (e.g. back button or swipe gesture).
// When calling goBack on frame isBack will be false.
let isBack: boolean = currentEntry && newEntry === currentEntry;
@ -337,8 +345,6 @@ class UINavigationControllerImpl extends UINavigationController implements UINav
frame._navigateToEntry = null;
frame._currentEntry = newEntry;
let newPage = newEntry.resolvedPage;
// In iOS we intentionally delay the raising of the 'loaded' event so both platforms behave identically.
// The loaded event must be raised AFTER the page is part of the windows hierarchy and
// frame.topmost().currentPage is set to the page instance.