-
-
Notifications
You must be signed in to change notification settings - Fork 585
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:
Screen_Recording_20250924_151216_FabricExample.mp4
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
endRemovalTransition
inScreen.kt
as 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