fix(Android, Stack v4): Fix crash when a Screen is reordered inside ScreenStack - #4492
Draft
t0maboro wants to merge 2 commits into
Draft
fix(Android, Stack v4): Fix crash when a Screen is reordered inside ScreenStack#4492t0maboro wants to merge 2 commits into
t0maboro wants to merge 2 commits into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes an Android Stack v4 crash caused by Fabric screen reordering.
Changes:
- Detects screen moves within mounting transactions.
- Detaches moved screens without starting removal transitions.
- Adds a manual regression reproducer.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
cpp/legacy/RNSScreenRemovalListener.cpp |
Distinguishes moves from removals. |
android/.../ScreenStackViewManager.kt |
Immediately detaches moved screens. |
apps/src/tests/issue-tests/TestXXXX.tsx |
Reproduces concurrent screen and child reordering. |
apps/src/tests/issue-tests/index.ts |
Registers the reproducer. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| export { default as Test4357 } from './Test4357'; | ||
| export { default as Test4361 } from './Test4361'; | ||
| export { default as Test4423 } from './Test4423'; | ||
| export { default as TestXXXX } from './TestXXXX'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fabric treats a screen move as a pair of
RemoveandInsertmutations in a single transaction. Our removal-detection paths could not detect a move to another parent and starts removal transition unconditionally, marking the whole subtree of a screen that stays alive withstartViewTransition.ViewGroupdoes not clearmParentfor views inmTransitioningViews, so when the same commit also reorders children inside the moved screen, their Remove leavesmParentset and thenInsertof the same view instance throws.Proposing a simple mechanism for detecting when the Screen moves to another parent, and in that case, removing it immediately from the current parent.
Changes
Before & after - visual documentation
Screen.Recording.2026-08-12.at.15.09.04.mov
Screen.Recording.2026-08-12.at.15.07.31.mov
Test plan
Added dedicated test
Checklist