[Fabric] `detachInactiveScreens=false` breaks reanimated and gesture handler when navigating between screens
Description
I got multiple issue reports under my react-native-sortables library repo which all seem to be related to setting detachInactiveScreens=false option on the navigator.
I was able to consistently reproduce issues and narrow them down to simple reproduction examples which I attached in react-native-reanimated and react-native-gesture-handler repositories:
- https://github.com/software-mansion/react-native-reanimated/issues/7627
- https://github.com/software-mansion/react-native-gesture-handler/issues/3560
I initially thought that this issue is related to react-native-reanimated, but since gesture handler also is affected, I feel that the root cause of the problem is the react-native-screens library. In both cases the issue is gone when I disable screens via enableScreens(false).
Steps to reproduce
- Set
detachInactiveScreenstofalseon the tab/stack navigator (I tested with bottom tabs) - Copy one of the linked repro examples in reanimated/gesture handler repos
- Observe that they are broken when
detachInactiveScreens=falseand screens are enabled
Snack or a link to a repository
https://snack.expo.dev/@matipl01/gesture-handler-not-working-after-screen-change?platform=ios, https://snack.expo.dev/@matipl01/layout-transitions-repro
Screens version
4.11.1 (and older)
React Native version
0.80 (and older)
Platforms
iOS
JavaScript runtime
Hermes
Workflow
None
Architecture
Fabric (New Architecture)
Build type
None
Device
None
Device model
No response
Acknowledgements
Yes