From ae56155e61a419d0d13822fb9cbfdb3cdb1600b8 Mon Sep 17 00:00:00 2001 From: Dimitris - Rafail Katsampas Date: Wed, 16 Sep 2026 17:51:44 +0300 Subject: [PATCH] fix(core): Add frames back to frame-stack if removed during back press --- packages/core/ui/frame/frame-common.ts | 9 +++++++++ packages/core/ui/frame/index.android.ts | 8 -------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/packages/core/ui/frame/frame-common.ts b/packages/core/ui/frame/frame-common.ts index b6d090a755..71b3b3c13c 100644 --- a/packages/core/ui/frame/frame-common.ts +++ b/packages/core/ui/frame/frame-common.ts @@ -134,6 +134,15 @@ export class FrameBase extends CustomLayoutView implements FrameDefinition { @profile public onLoaded() { + /** + * In android 12 and newer, back press can exit app without finishing activity but still removes the frame from stack. + * In that case, we rely on loaded lifecycle to add the frame back. + * Also, make sure the loaded lifecycle does not attempt to push the frame when it's already in the stack but is not the topmost. + */ + if (this._currentEntry && !this._isInFrameStack) { + this._pushInFrameStack(); + } + super.onLoaded(); this._processNextNavigationEntry(); } diff --git a/packages/core/ui/frame/index.android.ts b/packages/core/ui/frame/index.android.ts index d98f76ab91..c2340b926f 100644 --- a/packages/core/ui/frame/index.android.ts +++ b/packages/core/ui/frame/index.android.ts @@ -547,14 +547,6 @@ export class Frame extends FrameBase { super.disposeNativeView(); } - public _popFromFrameStack() { - if (!this._isInFrameStack) { - return; - } - - super._popFromFrameStack(); - } - public _getNavBarVisible(page: Page): boolean { switch (this.actionBarVisibility) { case 'never':