mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-18 22:01:42 +08:00
Merge branch 'android_start_flash_fix' of github.com:Akylas/NativeScript
This commit is contained in:
@ -85,6 +85,7 @@ export class Frame extends FrameBase {
|
||||
private _containerViewId = -1;
|
||||
private _tearDownPending = false;
|
||||
private _attachedToWindow = false;
|
||||
private _wasReset = false;
|
||||
private _cachedTransitionState: TransitionState;
|
||||
|
||||
constructor() {
|
||||
@ -151,6 +152,7 @@ export class Frame extends FrameBase {
|
||||
}
|
||||
|
||||
this._attachedToWindow = true;
|
||||
this._wasReset = false;
|
||||
this._processNextNavigationEntry();
|
||||
}
|
||||
|
||||
@ -165,7 +167,16 @@ export class Frame extends FrameBase {
|
||||
// In this case call _navigateCore in order to recreate the current fragment.
|
||||
// Don't call navigate because it will fire navigation events.
|
||||
// As JS instances are alive it is already done for the current page.
|
||||
if (!this.isLoaded || this._executingContext || !this._attachedToWindow) {
|
||||
if (!this.isLoaded || this._executingContext) {
|
||||
return;
|
||||
}
|
||||
|
||||
// in case the activity is "reset" using resetRootView we must wait for
|
||||
// the attachedToWindow event to make the first navigation or it will crash
|
||||
// https://github.com/NativeScript/NativeScript/commit/9dd3e1a8076e5022e411f2f2eeba34aabc68d112
|
||||
// though we should not do it on app "start"
|
||||
// or it will create a "flash" to activity background color
|
||||
if (this._wasReset && !this._attachedToWindow) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -225,7 +236,8 @@ export class Frame extends FrameBase {
|
||||
|
||||
public _onRootViewReset(): void {
|
||||
super._onRootViewReset();
|
||||
|
||||
// used to handle the "first" navigate differently on first run and on reset
|
||||
this._wasReset = true;
|
||||
// call this AFTER the super call to ensure descendants apply their rootview-reset logic first
|
||||
// i.e. in a scenario with nested frames / frame with tabview let the descendandt cleanup the inner
|
||||
// fragments first, and then cleanup the parent fragments
|
||||
|
Reference in New Issue
Block a user