Wasn't sure if I should create this issue in this repo or in the react-native-screens one. But here we go!
When having enableFreeze(true), useSharedValue resets to the initial value when moving to another screen within a bottom tab navigator and then back again. Since FirstScreen is not unmounted, I would expect it to keep the value at 300.
Update: It seems to work (staying at 300) in RN 0.73 and in 0.74 when I disable new architecture, so it was likely introduced by the bridgeless mode.
Description
Wasn't sure if I should create this issue in this repo or in the react-native-screens one. But here we go!
When having
enableFreeze(true)
, useSharedValue resets to the initial value when moving to another screen within a bottom tab navigator and then back again. Since FirstScreen is not unmounted, I would expect it to keep the value at 300.Update: It seems to work (staying at 300) in RN 0.73 and in 0.74 when I disable new architecture, so it was likely introduced by the bridgeless mode.
https://github.com/user-attachments/assets/41c91b91-ea8f-4c8c-95cd-f11bbc46935e
Steps to reproduce
Snack or a link to a repository
https://github.com/vilindberg/reanimated-shared-value-between-stacks
Reanimated version
3.16.1
React Native version
0.76.2
Platforms
iOS
JavaScript runtime
None
Workflow
React Native
Architecture
Fabric (New Architecture)
Build type
None
Device
iOS simulator
Device model
iPhone 16 (iOS 18)
Acknowledgements
Yes