software-mansion / software-mansion/react-native-screens
View recycling breaks due to fragment view transitions
@kkafar is already working on this.
Since Sep 25, 2025.
- Dominant language
- TypeScript
- Stars
- 3.7k
- Forks
- 714
- Avg merge
- 2d 23h
- Merged PRs (30d)
- 71
Description
Description
When a native view manager reuses native views, such as when turning on View Recycling, there can be crashes caused by the react-native mounting layer trying to add a recycled view which still has a parent attached.
The red view you can see in this video is a recycled view, so each screen will try to use the same native instance of the view:
https://github.com/user-attachments/assets/616e9db4-d51f-4250-8937-1d09d3289f64
addViewAt: failed to insert view [1560] into parent [1564] at index 1
The specified child already has a parent. You must call removeView) on the child's parent first.
To fix this I believe we need to:
- fix RNS
endRemovalTransitioninScreen.ktas its currently broken and not correctly ending view transitions - make changes in react-native core for handling "in-transition" views
I have a PR that tries to address that issue here:
Steps to reproduce
The reproduction can be seen here:
To test it out simply clone / checkout & build from this branch:
Note: In this reproduction i didn't turn on view reycling, but just always return the same native view instance. This is reproducing how view recycling behaves.
I have an additional reproduction with view recycling in the PoC PR for fixing this issue:
Snack or a link to a repository
Screens version
latest main
React Native version
0.81.1
Platforms
Android
JavaScript runtime
Hermes
Workflow
React Native (without Expo)
Architecture
Fabric (New Architecture)
Build type
Debug mode
Device
Real device
Device model
No response
Acknowledgements
Yes
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.