fix(frame): nested frame wrong background after parent navigation (#8095)

This commit is contained in:
Alexander Djenkov
2019-11-14 16:43:19 +02:00
committed by GitHub
parent bca1271329
commit d983f79923

View File

@ -10,7 +10,7 @@ import * as application from "../../application";
import { import {
_stack, FrameBase, NavigationType, Observable, _stack, FrameBase, NavigationType, Observable,
traceCategories, traceEnabled, traceError, traceWrite, View traceCategories, traceEnabled, traceError, traceWrite, View, Color
} from "./frame-common"; } from "./frame-common";
import { import {
@ -91,6 +91,7 @@ function getAttachListener(): android.view.View.OnAttachStateChangeListener {
} }
export class Frame extends FrameBase { export class Frame extends FrameBase {
public _originalBackground: any;
private _android: AndroidFrame; private _android: AndroidFrame;
private _containerViewId: number = -1; private _containerViewId: number = -1;
private _tearDownPending = false; private _tearDownPending = false;
@ -241,6 +242,16 @@ export class Frame extends FrameBase {
this.disposeCurrentFragment(); this.disposeCurrentFragment();
} }
onLoaded(): void {
if (this._originalBackground) {
this.backgroundColor = null;
this.backgroundColor = this._originalBackground;
this._originalBackground = null;
}
super.onLoaded();
}
onUnloaded() { onUnloaded() {
super.onUnloaded(); super.onUnloaded();
@ -946,6 +957,7 @@ class FragmentCallbacksImplementation implements AndroidFragmentCallbacks {
if (hasRemovingParent) { if (hasRemovingParent) {
const bitmapDrawable = new android.graphics.drawable.BitmapDrawable(application.android.context.getResources(), this.backgroundBitmap); 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.frame.nativeViewProtected.setBackgroundDrawable(bitmapDrawable);
this.backgroundBitmap = null; this.backgroundBitmap = null;
} }