mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
Back to animated nav-bar
This commit is contained in:
@@ -18,8 +18,7 @@ export function applyTapOnStyledActionBar(args) {
|
||||
reset(page);
|
||||
|
||||
page.actionBar.backgroundColor = new color.Color("#5DFC0A");
|
||||
var css = "#test-element { " + args.object.tag + " }";
|
||||
page.css = css;
|
||||
page.css = "#test-element { " + args.object.tag + " }";
|
||||
}
|
||||
|
||||
export function applyTapWithHiddenActionBar(args) {
|
||||
@@ -28,8 +27,7 @@ export function applyTapWithHiddenActionBar(args) {
|
||||
reset(page);
|
||||
|
||||
page.actionBarHidden = true;
|
||||
var css = "#test-element { " + args.object.tag + " }";
|
||||
page.css = css;
|
||||
page.css = "#test-element { " + args.object.tag + " }";
|
||||
}
|
||||
|
||||
export function applyTapWithSpan(args) {
|
||||
@@ -38,8 +36,7 @@ export function applyTapWithSpan(args) {
|
||||
reset(page);
|
||||
|
||||
page.backgroundSpanUnderStatusBar = true;
|
||||
var css = "#test-element { " + args.object.tag + " }";
|
||||
page.css = css;
|
||||
page.css = "#test-element { " + args.object.tag + " }";
|
||||
}
|
||||
|
||||
export function applyTapOnStyledActionBarAndSpan(args) {
|
||||
@@ -49,8 +46,7 @@ export function applyTapOnStyledActionBarAndSpan(args) {
|
||||
|
||||
page.backgroundSpanUnderStatusBar = true;
|
||||
page.actionBar.backgroundColor = new color.Color("#E0115F");
|
||||
var css = "#test-element { " + args.object.tag + " }";
|
||||
page.css = css;
|
||||
page.css = "#test-element { " + args.object.tag + " }";
|
||||
}
|
||||
|
||||
export function applyTapWithActionBarHiddenAndSpan(args) {
|
||||
@@ -59,9 +55,8 @@ export function applyTapWithActionBarHiddenAndSpan(args) {
|
||||
reset(page);
|
||||
|
||||
page.backgroundSpanUnderStatusBar = true;
|
||||
page.actionBarHidden = true;;
|
||||
var css = "#test-element { " + args.object.tag + " }";
|
||||
page.css = css;
|
||||
page.actionBarHidden = true;
|
||||
page.css = "#test-element { " + args.object.tag + " }";
|
||||
}
|
||||
|
||||
function reset(page: page.Page) {
|
||||
|
||||
@@ -142,9 +142,6 @@ export class FileNameResolver implements definition.FileNameResolver {
|
||||
var candidates = this.getFileCandidatesFromFolder(path, ext);
|
||||
result = _findFileMatch(path, ext, candidates, this._context);
|
||||
|
||||
if (trace.enabled) {
|
||||
trace.write("Resolved file name for \"" + path + ext + "\" result: " + (result ? result : "no match found"), trace.categories.Navigation);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -179,9 +176,6 @@ export function _findFileMatch(path: string, ext: string, candidates: Array<stri
|
||||
var bestValue = -1
|
||||
var result: string = null;
|
||||
|
||||
if (trace.enabled) {
|
||||
trace.write("Candidates for " + path + ext + ": " + candidates.join(", "), trace.categories.Navigation);
|
||||
}
|
||||
for (var i = 0; i < candidates.length; i++) {
|
||||
var filePath = candidates[i];
|
||||
var qualifiersStr: string = filePath.substr(path.length, filePath.length - path.length - ext.length);
|
||||
|
||||
@@ -321,7 +321,7 @@ export class Frame extends CustomLayoutView implements definition.Frame {
|
||||
return !backstackHidden;
|
||||
}
|
||||
|
||||
public _updateActionBar(page?: Page) {
|
||||
public _updateActionBar(page?: Page, disableNavBarAnimation?: boolean) {
|
||||
//trace.write("calling _updateActionBar on Frame", trace.categories.Navigation);
|
||||
}
|
||||
|
||||
|
||||
2
tns-core-modules/ui/frame/frame.d.ts
vendored
2
tns-core-modules/ui/frame/frame.d.ts
vendored
@@ -104,7 +104,7 @@ declare module "ui/frame" {
|
||||
navigationQueueIsEmpty(): boolean;
|
||||
navigationBarHeight: number;
|
||||
_processNavigationQueue(page: pages.Page);
|
||||
_updateActionBar(page?: pages.Page);
|
||||
_updateActionBar(page?: pages.Page, disableNavBarAnimation?: boolean);
|
||||
_getNavBarVisible(page: pages.Page): boolean;
|
||||
//@endprivate
|
||||
|
||||
|
||||
@@ -109,10 +109,10 @@ export class Frame extends frameCommon.Frame {
|
||||
backstackEntry[NAV_DEPTH] = navDepth;
|
||||
viewController[ENTRY] = backstackEntry;
|
||||
|
||||
this._updateActionBar(backstackEntry.resolvedPage);
|
||||
|
||||
// First navigation.
|
||||
if (!this._currentEntry) {
|
||||
// Update action-bar with disabled animations before the initial navigation.
|
||||
this._updateActionBar(backstackEntry.resolvedPage, true);
|
||||
this._ios.controller.pushViewControllerAnimated(viewController, animated);
|
||||
if (trace.enabled) {
|
||||
trace.write(`${this}.pushViewControllerAnimated(${viewController}, ${animated}); depth = ${navDepth}`, trace.categories.Navigation);
|
||||
@@ -189,16 +189,23 @@ export class Frame extends frameCommon.Frame {
|
||||
}
|
||||
}
|
||||
|
||||
public _updateActionBar(page?: Page): void {
|
||||
public _updateActionBar(page?: Page, disableNavBarAnimation: boolean = false): void {
|
||||
super._updateActionBar(page);
|
||||
|
||||
page = page || this.currentPage;
|
||||
let newValue = this._getNavBarVisible(page);
|
||||
|
||||
var disableNavBarAnimation = this._ios._disableNavBarAnimation;
|
||||
let disableNavBarAnimationCache = this._ios._disableNavBarAnimation;
|
||||
|
||||
if (disableNavBarAnimation) {
|
||||
this._ios._disableNavBarAnimation = true;
|
||||
}
|
||||
|
||||
this._ios.showNavigationBar = newValue;
|
||||
this._ios._disableNavBarAnimation = disableNavBarAnimation;
|
||||
|
||||
if (disableNavBarAnimation) {
|
||||
this._ios._disableNavBarAnimation = disableNavBarAnimationCache;
|
||||
}
|
||||
|
||||
if (this._ios.controller.navigationBar) {
|
||||
this._ios.controller.navigationBar.userInteractionEnabled = this.navigationQueueIsEmpty();
|
||||
@@ -693,7 +700,6 @@ class iOSFrame implements definition.iOSFrame {
|
||||
this._frame = frame;
|
||||
this._controller = UINavigationControllerImpl.initWithOwner(new WeakRef(frame));
|
||||
this._controller.automaticallyAdjustsScrollViewInsets = false;
|
||||
//this.showNavigationBar = false;
|
||||
this._navBarVisibility = NavigationBarVisibility.auto;
|
||||
}
|
||||
|
||||
|
||||
@@ -47,7 +47,8 @@ const actionBarHiddenProperty = new Property("actionBarHidden", "Page", new prox
|
||||
function onActionBarHiddenPropertyChanged(data: PropertyChangeData) {
|
||||
const page = <Page>data.object;
|
||||
if (page.isLoaded) {
|
||||
page._updateActionBar(data.newValue);
|
||||
// Update with disabled animation when setting visibility
|
||||
page._updateActionBar(true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -101,7 +102,7 @@ export class Page extends ContentView implements dts.Page {
|
||||
this._applyCss();
|
||||
|
||||
if (this.actionBarHidden !== undefined) {
|
||||
this._updateActionBar(this.actionBarHidden);
|
||||
this._updateActionBar();
|
||||
}
|
||||
|
||||
this._updateStatusBar();
|
||||
@@ -148,7 +149,7 @@ export class Page extends ContentView implements dts.Page {
|
||||
this._setValue(Page.iosSwipeBackNavigationEnabledProperty, value);
|
||||
}
|
||||
|
||||
public _updateActionBar(hidden: boolean) {
|
||||
public _updateActionBar(disableNavBarAnimation?: boolean) {
|
||||
//
|
||||
}
|
||||
|
||||
|
||||
@@ -187,7 +187,7 @@ export class Page extends pageCommon.Page {
|
||||
super._hideNativeModalView(parent);
|
||||
}
|
||||
|
||||
public _updateActionBar(hidden: boolean) {
|
||||
public _updateActionBar() {
|
||||
this.actionBar.update();
|
||||
}
|
||||
|
||||
|
||||
@@ -144,11 +144,9 @@ class UIViewControllerImpl extends UIViewController {
|
||||
super.viewWillAppear(animated);
|
||||
this.shown = false;
|
||||
let page = this._owner.get();
|
||||
if (trace.enabled) {
|
||||
if (trace.enabled) {
|
||||
trace.write(page + " viewWillAppear", trace.categories.Navigation);
|
||||
}
|
||||
}
|
||||
if (!page) {
|
||||
return;
|
||||
}
|
||||
@@ -349,7 +347,7 @@ export class Page extends pageCommon.Page {
|
||||
if (this._enableLoadedEvents) {
|
||||
super.onLoaded();
|
||||
}
|
||||
this._updateActionBar(false);
|
||||
this._updateActionBar();
|
||||
}
|
||||
|
||||
public onUnloaded() {
|
||||
@@ -433,10 +431,10 @@ export class Page extends pageCommon.Page {
|
||||
super._hideNativeModalView(parent);
|
||||
}
|
||||
|
||||
public _updateActionBar(hidden: boolean) {
|
||||
public _updateActionBar(disableNavBarAnimation: boolean = false) {
|
||||
const frame = this.frame;
|
||||
if (frame) {
|
||||
frame._updateActionBar(this);
|
||||
frame._updateActionBar(this, disableNavBarAnimation);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user