mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-17 21:01:34 +08:00
Merge pull request #194 from NativeScript/feature/ios-navbar-layout-fix
Request layout when showing/hiding the navbar
This commit is contained in:
@ -71,20 +71,28 @@ export class Frame extends frameCommon.Frame {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public updateNavigationBar(page?: pages.Page): void {
|
public updateNavigationBar(page?: pages.Page): void {
|
||||||
|
var previousValue = !!this._ios.showNavigationBar;
|
||||||
|
var newValue: boolean = false;
|
||||||
switch (this._ios.navBarVisibility) {
|
switch (this._ios.navBarVisibility) {
|
||||||
case enums.NavigationBarVisibility.always:
|
case enums.NavigationBarVisibility.always:
|
||||||
this._ios.showNavigationBar = true;
|
newValue = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case enums.NavigationBarVisibility.never:
|
case enums.NavigationBarVisibility.never:
|
||||||
this._ios.showNavigationBar = false;
|
newValue = false;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case enums.NavigationBarVisibility.auto:
|
case enums.NavigationBarVisibility.auto:
|
||||||
var pageInstance: pages.Page = page || this.currentPage;
|
var pageInstance: pages.Page = page || this.currentPage;
|
||||||
this._ios.showNavigationBar = this.backStack.length > 0 || (pageInstance && pageInstance.optionsMenu.getItems().length > 0);
|
newValue = this.backStack.length > 0 || (pageInstance && pageInstance.optionsMenu.getItems().length > 0);
|
||||||
|
newValue = !!newValue; // Make sure it is boolean
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this._ios.showNavigationBar = newValue;
|
||||||
|
if (previousValue !== newValue) {
|
||||||
|
this.requestLayout();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public get ios(): iOSFrame {
|
public get ios(): iOSFrame {
|
||||||
|
Reference in New Issue
Block a user