Merge branch 'master' into remove-tns-core-modules-mentions

This commit is contained in:
Dimitar Topuzov
2019-12-04 12:24:40 +02:00
committed by GitHub
27 changed files with 207 additions and 60 deletions

View File

@@ -59,12 +59,12 @@ export class FrameBase extends CustomLayoutView implements FrameDefinition {
const top = FrameBase.topmost();
if (top && top.canGoBack()) {
top.goBack();
return true;
} else if (top) {
let parentFrameCanGoBack = false;
let parentFrame = <FrameBase>getAncestor(top, "Frame");
while (parentFrame && !parentFrameCanGoBack) {
if (parentFrame && parentFrame.canGoBack()) {
parentFrameCanGoBack = true;
@@ -72,18 +72,18 @@ export class FrameBase extends CustomLayoutView implements FrameDefinition {
parentFrame = <FrameBase>getAncestor(parentFrame, "Frame");
}
}
if (parentFrame && parentFrameCanGoBack) {
parentFrame.goBack();
return true;
}
}
if (frameStack.length > 1) {
top._popFromFrameStack();
}
return false;
}
@@ -205,11 +205,11 @@ export class FrameBase extends CustomLayoutView implements FrameDefinition {
traceWrite(`NAVIGATE`, traceCategories.Navigation);
}
this._pushInFrameStack();
const entry = buildEntryFromArgs(param);
const page = Builder.createViewFromEntry(entry) as Page;
this._pushInFrameStack();
const backstackEntry: BackstackEntry = {
entry: entry,
resolvedPage: page,

View File

@@ -11,7 +11,7 @@ import * as application from "../../application";
import {
_stack, FrameBase, NavigationType, Observable,
traceCategories, traceEnabled, traceError, traceWrite, View
traceCategories, traceEnabled, traceError, traceWrite, View, Color
} from "./frame-common";
import {
@@ -88,6 +88,7 @@ function getAttachListener(): android.view.View.OnAttachStateChangeListener {
}
export class Frame extends FrameBase {
public _originalBackground: any;
private _android: AndroidFrame;
private _containerViewId: number = -1;
private _tearDownPending = false;
@@ -238,6 +239,16 @@ export class Frame extends FrameBase {
this.disposeCurrentFragment();
}
onLoaded(): void {
if (this._originalBackground) {
this.backgroundColor = null;
this.backgroundColor = this._originalBackground;
this._originalBackground = null;
}
super.onLoaded();
}
onUnloaded() {
super.onUnloaded();
@@ -471,6 +482,13 @@ export class Frame extends FrameBase {
}
public createNativeView() {
// Create native view with available _currentEntry occur in Don't Keep Activities
// scenario when Activity is recreated on app suspend/resume. Push frame back in frame stack
// since it was removed in disposeNativeView() method.
if (this._currentEntry) {
this._pushInFrameStack();
}
return new org.nativescript.widgets.ContentLayout(this._context);
}
@@ -945,6 +963,7 @@ class FragmentCallbacksImplementation implements AndroidFragmentCallbacks {
if (hasRemovingParent) {
const bitmapDrawable = new android.graphics.drawable.BitmapDrawable(application.android.context.getResources(), this.backgroundBitmap);
this.frame._originalBackground = this.frame.backgroundColor || new Color("White");
this.frame.nativeViewProtected.setBackgroundDrawable(bitmapDrawable);
this.backgroundBitmap = null;
}

View File

@@ -541,7 +541,9 @@ class UINavigationControllerImpl extends UINavigationController {
if (majorVersion >= 13) {
const owner = this._owner.get();
if (owner && this.traitCollection.hasDifferentColorAppearanceComparedToTraitCollection(previousTraitCollection)) {
if (owner &&
this.traitCollection.hasDifferentColorAppearanceComparedToTraitCollection &&
this.traitCollection.hasDifferentColorAppearanceComparedToTraitCollection(previousTraitCollection)) {
owner.notify({ eventName: iosViewHelper.traitCollectionColorAppearanceChangedEvent, object: owner });
}
}