react-native-screens icon indicating copy to clipboard operation
react-native-screens copied to clipboard

[Fabric] `detachInactiveScreens=false` breaks reanimated and gesture handler when navigating between screens

Open MatiPl01 opened this issue 6 months ago • 0 comments

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

  1. Set detachInactiveScreens to false on the tab/stack navigator (I tested with bottom tabs)
  2. Copy one of the linked repro examples in reanimated/gesture handler repos
  3. Observe that they are broken when detachInactiveScreens=false and 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

MatiPl01 avatar Jun 15 '25 14:06 MatiPl01