Fixed: jumping action bar reported in #2941

This commit is contained in:
Tsvetan Raikov
2016-11-09 15:16:18 +02:00
parent a7746f31a3
commit a0cd3b0f39

View File

@@ -139,6 +139,7 @@ class UIViewControllerImpl extends UIViewController {
} }
public viewWillAppear(animated: boolean): void { public viewWillAppear(animated: boolean): void {
super.viewWillAppear(animated);
let page = this._owner.get(); let page = this._owner.get();
if (trace.enabled) { if (trace.enabled) {
if (trace.enabled) { if (trace.enabled) {
@@ -158,6 +159,8 @@ class UIViewControllerImpl extends UIViewController {
page.onNavigatingTo(newEntry.entry.context, isBack, newEntry.entry.bindingContext); page.onNavigatingTo(newEntry.entry.context, isBack, newEntry.entry.bindingContext);
} }
page._enableLoadedEvents = true;
if (frame) { if (frame) {
if (!page.parent) { if (!page.parent) {
if (!frame._currentEntry) { if (!frame._currentEntry) {
@@ -178,7 +181,6 @@ class UIViewControllerImpl extends UIViewController {
//https://github.com/NativeScript/NativeScript/issues/1201 //https://github.com/NativeScript/NativeScript/issues/1201
page._viewWillDisappear = false; page._viewWillDisappear = false;
page._enableLoadedEvents = true;
// Pages in backstack are unloaded so raise loaded here. // Pages in backstack are unloaded so raise loaded here.
if (!page.isLoaded) { if (!page.isLoaded) {
page.onLoaded(); page.onLoaded();
@@ -188,6 +190,7 @@ class UIViewControllerImpl extends UIViewController {
} }
public viewDidAppear(animated: boolean): void { public viewDidAppear(animated: boolean): void {
super.viewDidAppear(animated);
let page = this._owner.get(); let page = this._owner.get();
if (trace.enabled) { if (trace.enabled) {
trace.write(page + " viewDidAppear", trace.categories.Navigation); trace.write(page + " viewDidAppear", trace.categories.Navigation);
@@ -233,7 +236,7 @@ class UIViewControllerImpl extends UIViewController {
if (!this.presentedViewController) { if (!this.presentedViewController) {
// clear presented viewController here only if no presented controller. // clear presented viewController here only if no presented controller.
// this is needed because in iOS9 the order of events could be - willAppear, willDisappear, didAppear. // this is needed because in iOS9 the order of events could be - willAppear, willDisappear, didAppear.
// If we clean it when we have viewController then once presented VC is dismissed then // If we clean it when we have viewController then once presented VC is dismissed then
page._presentedViewController = null; page._presentedViewController = null;
} }
}; };
@@ -247,7 +250,7 @@ class UIViewControllerImpl extends UIViewController {
return; return;
} }
// Cache presentedViewController if any. We don't want to raise // Cache presentedViewController if any. We don't want to raise
// navigation events in case of presenting view controller. // navigation events in case of presenting view controller.
if (!page._presentedViewController) { if (!page._presentedViewController) {
page._presentedViewController = this.presentedViewController; page._presentedViewController = this.presentedViewController;
@@ -444,7 +447,7 @@ export class Page extends pageCommon.Page {
public onMeasure(widthMeasureSpec: number, heightMeasureSpec: number) { public onMeasure(widthMeasureSpec: number, heightMeasureSpec: number) {
View.adjustChildLayoutParams(this.layoutView, widthMeasureSpec, heightMeasureSpec); View.adjustChildLayoutParams(this.layoutView, widthMeasureSpec, heightMeasureSpec);
let width = utils.layout.getMeasureSpecSize(widthMeasureSpec); let width = utils.layout.getMeasureSpecSize(widthMeasureSpec);
let widthMode = utils.layout.getMeasureSpecMode(widthMeasureSpec); let widthMode = utils.layout.getMeasureSpecMode(widthMeasureSpec);
@@ -468,7 +471,7 @@ export class Page extends pageCommon.Page {
} }
if (this.frame && this.frame._getNavBarVisible(this)) { if (this.frame && this.frame._getNavBarVisible(this)) {
// Measure ActionBar with the full height. // Measure ActionBar with the full height.
let actionBarSize = View.measureChild(this, this.actionBar, widthMeasureSpec, heightMeasureSpec); let actionBarSize = View.measureChild(this, this.actionBar, widthMeasureSpec, heightMeasureSpec);
actionBarWidth = actionBarSize.measuredWidth; actionBarWidth = actionBarSize.measuredWidth;
actionBarHeight = actionBarSize.measuredHeight; actionBarHeight = actionBarSize.measuredHeight;