Skip to content

fix(core): Add frames back to frame-stack if removed during back press - #11437

Draft
CatchABus wants to merge 1 commit into
NativeScript:mainfrom
CatchABus:fix/frame-stack-bug
Draft

CatchABus wants to merge 1 commit into
NativeScript:mainfrom
CatchABus:fix/frame-stack-bug

Conversation

@CatchABus

@CatchABus CatchABus commented Sep 16, 2026

Copy link
Copy Markdown
Contributor

PR Checklist

What is the current behavior?

In android 12 and later, root launcher activities are no longer finished on Back press.
However, {N} core overrides backpress and removes frames from stack at times, thinking that the activity will finish.
Then, user attempts to launch the app and it will simply resume without recreating views and frames will still be missing from the stack.

That results in Frame topmost() and getFrameById() returning a wrong frame instance in apps with multiple frames.

What is the new behavior?

This PR uses a workaround in loaded lifecycle to ensure the removed frames regain their place in the frame stack.
Because the stack push function may change the position of an existing frame in it, we make sure to check _isInFrameStack too before acting.

The PR also removes an unneeded override of _popFromFrameStack.

Fixes/Closes #11436.

@nx-cloud

nx-cloud Bot commented Sep 16, 2026

Copy link
Copy Markdown

View your CI Pipeline Execution ↗ for commit ae56155

Command Status Duration Result
nx test apps-automated -c=ios ✅ Succeeded 2m 33s View ↗
nx run-many --target=test --configuration=ci --... ✅ Succeeded 3s View ↗

💡 Verify your cache is correct by running tasks in a sandbox. Read docs ↗


☁️ Nx Cloud last updated this comment at 2026-09-16 15:02:25 UTC

@pkg-pr-new

pkg-pr-new Bot commented Sep 16, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/@nativescript/core@11437
npm i https://pkg.pr.new/@nativescript/vite@11437
npm i https://pkg.pr.new/@nativescript/webpack@11437

commit: ae56155

@CatchABus
CatchABus marked this pull request as draft September 16, 2026 15:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Android frames are missing from frame stack after backpress and app resume

1 participant