Merge pull request #1868 from NativeScript/cankov/no-initial-actionbar-animation

No iOS UINavigationBar animation for the first Page
This commit is contained in:
Panayot Cankov
2016-03-31 10:17:14 +03:00

View File

@ -31,6 +31,7 @@ export class Frame extends frameCommon.Frame {
public _heightMeasureSpec: number; public _heightMeasureSpec: number;
public _right: number; public _right: number;
public _bottom: number; public _bottom: number;
public _isInitialNavigation: boolean = true;
constructor() { constructor() {
super(); super();
@ -61,6 +62,7 @@ export class Frame extends frameCommon.Frame {
public navigate(param: any) { public navigate(param: any) {
if (this.isLoaded) { if (this.isLoaded) {
super.navigate(param); super.navigate(param);
this._isInitialNavigation = false;
} }
else { else {
this._paramToNavigate = param; this._paramToNavigate = param;
@ -608,9 +610,11 @@ class iOSFrame implements definition.iOSFrame {
private _controller: UINavigationControllerImpl; private _controller: UINavigationControllerImpl;
private _showNavigationBar: boolean; private _showNavigationBar: boolean;
private _navBarVisibility: string; private _navBarVisibility: string;
private _frame: Frame;
constructor(owner: Frame) { constructor(frame: Frame) {
this._controller = UINavigationControllerImpl.initWithOwner(new WeakRef(owner)); this._frame = frame;
this._controller = UINavigationControllerImpl.initWithOwner(new WeakRef(frame));
this._controller.automaticallyAdjustsScrollViewInsets = false; this._controller.automaticallyAdjustsScrollViewInsets = false;
//this.showNavigationBar = false; //this.showNavigationBar = false;
this._navBarVisibility = NavigationBarVisibility.auto; this._navBarVisibility = NavigationBarVisibility.auto;
@ -626,7 +630,9 @@ class iOSFrame implements definition.iOSFrame {
public set showNavigationBar(value: boolean) { public set showNavigationBar(value: boolean) {
var change = this._showNavigationBar !== value; var change = this._showNavigationBar !== value;
this._showNavigationBar = value; this._showNavigationBar = value;
this._controller.setNavigationBarHiddenAnimated(!value, true);
let animated = !this._frame._isInitialNavigation;
this._controller.setNavigationBarHiddenAnimated(!value, animated);
let currentPage = this._controller.owner.currentPage; let currentPage = this._controller.owner.currentPage;
if (currentPage && change) { if (currentPage && change) {