mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
fix(android): fragment creation loaded/unloaded protection
This commit is contained in:
@@ -84,6 +84,7 @@ export class Frame extends FrameBase {
|
||||
private _tearDownPending = false;
|
||||
private _attachedToWindow = false;
|
||||
private _cachedTransitionState: TransitionState;
|
||||
private _frameCreateTimeout: NodeJS.Timeout;
|
||||
|
||||
constructor() {
|
||||
super();
|
||||
@@ -237,7 +238,7 @@ export class Frame extends FrameBase {
|
||||
this.backgroundColor = this._originalBackground;
|
||||
this._originalBackground = null;
|
||||
}
|
||||
setTimeout(() => {
|
||||
this._frameCreateTimeout = setTimeout(() => {
|
||||
// there's a bug with nested frames where sometimes the nested fragment is not recreated at all
|
||||
// so we manually check on loaded event if the fragment is not recreated and recreate it
|
||||
const currentEntry = this._currentEntry || this._executingContext?.entry;
|
||||
@@ -258,6 +259,10 @@ export class Frame extends FrameBase {
|
||||
|
||||
onUnloaded() {
|
||||
super.onUnloaded();
|
||||
if (typeof this._frameCreateTimeout === 'number') {
|
||||
clearTimeout(this._frameCreateTimeout);
|
||||
this._frameCreateTimeout = null;
|
||||
}
|
||||
}
|
||||
|
||||
private disposeCurrentFragment(): void {
|
||||
|
||||
Reference in New Issue
Block a user