mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-15 11:01:21 +08:00
fix(frame): nested frame wrong background after parent navigation (#8095)
This commit is contained in:

committed by
GitHub

parent
bca1271329
commit
d983f79923
@ -10,7 +10,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 {
|
||||
@ -91,6 +91,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;
|
||||
@ -241,6 +242,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();
|
||||
|
||||
@ -946,6 +957,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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user