mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
fix(layouts): rootlayout not closing when no shadecover transition specified (#9278)
This commit is contained in:
committed by
Nathan Walker
parent
b4415683d8
commit
3c569effed
@@ -3,7 +3,7 @@
|
||||
"main": "index",
|
||||
"types": "index.d.ts",
|
||||
"description": "NativeScript Core Modules",
|
||||
"version": "8.0.0-alpha.2",
|
||||
"version": "8.0.0-alpha.4",
|
||||
"homepage": "https://nativescript.org",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
||||
@@ -45,9 +45,12 @@ export class RootLayoutBase extends GridLayout {
|
||||
this.updateShadeCover(this.shadeCover, options.shadeCover);
|
||||
}
|
||||
|
||||
view.opacity = 0; // always begin with view invisible when adding dynamically
|
||||
this.insertChild(view, this.getChildrenCount() + 1);
|
||||
|
||||
if (options?.animation?.enterFrom) {
|
||||
setTimeout(() => {
|
||||
// only apply initial state and animate after the first tick - ensures safe areas and other measurements apply correctly
|
||||
this.applyInitialState(view, options.animation.enterFrom);
|
||||
this.getEnterAnimation(view, options.animation.enterFrom)
|
||||
.play()
|
||||
@@ -60,6 +63,7 @@ export class RootLayoutBase extends GridLayout {
|
||||
Trace.write(`Error playing enter animation: ${ex}`, Trace.categories.Layout, Trace.messageType.error);
|
||||
}
|
||||
});
|
||||
});
|
||||
} else {
|
||||
resolve();
|
||||
}
|
||||
@@ -88,7 +92,7 @@ export class RootLayoutBase extends GridLayout {
|
||||
|
||||
// update shade cover with the topmost popupView options (if not specifically told to ignore)
|
||||
const shadeCoverOptions = this.popupViews[this.popupViews.length - 1]?.options?.shadeCover;
|
||||
if (shadeCoverOptions && !poppedView?.options?.shadeCover.ignoreShadeRestore) {
|
||||
if (this.shadeCover && shadeCoverOptions && !poppedView?.options?.shadeCover.ignoreShadeRestore) {
|
||||
this.updateShadeCover(this.shadeCover, shadeCoverOptions);
|
||||
}
|
||||
|
||||
@@ -97,7 +101,7 @@ export class RootLayoutBase extends GridLayout {
|
||||
const exitAnimations: Promise<any>[] = [exitAnimation.play()];
|
||||
|
||||
// add remove shade cover animation if this is the last opened popup view
|
||||
if (this.popupViews.length === 0) {
|
||||
if (this.popupViews.length === 0 && this.shadeCover) {
|
||||
exitAnimations.push(this.closeShadeCover(poppedView.options.shadeCover));
|
||||
}
|
||||
return Promise.all(exitAnimations)
|
||||
@@ -341,6 +345,7 @@ export class RootLayoutBase extends GridLayout {
|
||||
resolve();
|
||||
});
|
||||
}
|
||||
resolve();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user