Skip to content

Commit d983f79

Browse files
authored
fix(frame): nested frame wrong background after parent navigation (#8095)
1 parent bca1271 commit d983f79

1 file changed

Lines changed: 13 additions & 1 deletion

File tree

‎nativescript-core/ui/frame/frame.android.ts‎

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import * as application from "../../application";
1010

1111
import {
1212
_stack, FrameBase, NavigationType, Observable,
13-
traceCategories, traceEnabled, traceError, traceWrite, View
13+
traceCategories, traceEnabled, traceError, traceWrite, View, Color
1414
} from "./frame-common";
1515

1616
import {
@@ -91,6 +91,7 @@ function getAttachListener(): android.view.View.OnAttachStateChangeListener {
9191
}
9292

9393
export class Frame extends FrameBase {
94+
public _originalBackground: any;
9495
private _android: AndroidFrame;
9596
private _containerViewId: number = -1;
9697
private _tearDownPending = false;
@@ -241,6 +242,16 @@ export class Frame extends FrameBase {
241242
this.disposeCurrentFragment();
242243
}
243244

245+
onLoaded(): void {
246+
if (this._originalBackground) {
247+
this.backgroundColor = null;
248+
this.backgroundColor = this._originalBackground;
249+
this._originalBackground = null;
250+
}
251+
252+
super.onLoaded();
253+
}
254+
244255
onUnloaded() {
245256
super.onUnloaded();
246257

@@ -946,6 +957,7 @@ class FragmentCallbacksImplementation implements AndroidFragmentCallbacks {
946957

947958
if (hasRemovingParent) {
948959
const bitmapDrawable = new android.graphics.drawable.BitmapDrawable(application.android.context.getResources(), this.backgroundBitmap);
960+
this.frame._originalBackground = this.frame.backgroundColor || new Color("White");
949961
this.frame.nativeViewProtected.setBackgroundDrawable(bitmapDrawable);
950962
this.backgroundBitmap = null;
951963
}

0 commit comments

Comments
 (0)