Merge pull request #3093 from NativeScript/raikov/fix-2870

Fixed: ActionBar w/translucent navigationBar set to false is creating whitish transition
This commit is contained in:
tzraikov
2016-11-24 13:16:35 +02:00
committed by GitHub
2 changed files with 23 additions and 1 deletions

View File

@ -195,7 +195,11 @@ export class Frame extends frameCommon.Frame {
page = page || this.currentPage;
let newValue = this._getNavBarVisible(page);
var disableNavBarAnimation = this._ios._disableNavBarAnimation;
this._ios._disableNavBarAnimation = true;
this._ios.showNavigationBar = newValue;
this._ios._disableNavBarAnimation = disableNavBarAnimation;
if (this._ios.controller.navigationBar) {
this._ios.controller.navigationBar.userInteractionEnabled = this.navigationQueueIsEmpty();
}
@ -314,6 +318,12 @@ export class Frame extends frameCommon.Frame {
// If background does not span under statusbar - reduce available height and adjust top offset.
let statusBarHeight = (page && !page.backgroundSpanUnderStatusBar && !this.parent) ? uiUtils.ios.getStatusBarHeight() : 0;
// Status bar height should be ignored when UINavigationBar is visible and not translucent
if (this._ios.showNavigationBar &&
!this._ios.controller.navigationBar.translucent &&
page && (<any>page)._ios && !(<any>page)._ios.shown) {
statusBarHeight = 0;
}
View.layoutChild(this, page, 0, statusBarHeight, this._right, this._bottom);
}

View File

@ -57,11 +57,13 @@ class UIViewControllerImpl extends UIViewController {
public isBackstackSkipped: boolean;
public isBackstackCleared: boolean;
public shown: boolean;
public static initWithOwner(owner: WeakRef<Page>): UIViewControllerImpl {
let controller = <UIViewControllerImpl>UIViewControllerImpl.new();
controller._owner = owner;
controller.automaticallyAdjustsScrollViewInsets = false;
controller.shown = false;
return controller;
}
@ -140,6 +142,7 @@ class UIViewControllerImpl extends UIViewController {
public viewWillAppear(animated: boolean): void {
super.viewWillAppear(animated);
this.shown = false;
let page = this._owner.get();
if (trace.enabled) {
if (trace.enabled) {
@ -191,6 +194,7 @@ class UIViewControllerImpl extends UIViewController {
public viewDidAppear(animated: boolean): void {
super.viewDidAppear(animated);
this.shown = true;
let page = this._owner.get();
if (trace.enabled) {
trace.write(page + " viewDidAppear", trace.categories.Navigation);
@ -320,7 +324,7 @@ class UIViewControllerImpl extends UIViewController {
}
export class Page extends pageCommon.Page {
private _ios: UIViewController = UIViewControllerImpl.initWithOwner(new WeakRef(this));
private _ios: UIViewControllerImpl = UIViewControllerImpl.initWithOwner(new WeakRef(this));
public _enableLoadedEvents: boolean;
public _modalParent: Page;
public _UIModalPresentationFormSheet: boolean;
@ -499,6 +503,14 @@ export class Page extends pageCommon.Page {
navigationBarHeight = this.actionBar.getMeasuredHeight();
}
// Navigation bar height should be ignored when it is visible and not translucent
if (this.frame && this.frame.ios &&
this.frame.ios.controller.navigationBar &&
!this.frame.ios.controller.navigationBar.translucent &&
!this._ios.shown) {
navigationBarHeight = 0;
}
let statusBarHeight = this.backgroundSpanUnderStatusBar ? uiUtils.ios.getStatusBarHeight() : 0;
// If this page is inside nested frame - don't substract statusBarHeight again.