Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bridgeless with enableFreeze: useSharedValue resets to initialValue when navigating between screens #6728

Open
vilindberg opened this issue Nov 18, 2024 · 0 comments
Labels
Platform: iOS This issue is specific to iOS Repro provided A reproduction with a snippet of code, snack or repo is provided

Comments

@vilindberg
Copy link

vilindberg commented Nov 18, 2024

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.

Screen.Recording.2024-11-18.at.23.35.33.mov

Steps to reproduce

  1. Run the provided sample repo (https://github.com/vilindberg/reanimated-shared-value-between-stacks)
  2. Wait for the width to animate to 300 on FirstScreen
  3. Navigate to SecondScreen
  4. Navigate back to FirstScreen and the width will have been reset to 100

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

@github-actions github-actions bot added Repro provided A reproduction with a snippet of code, snack or repo is provided Platform: iOS This issue is specific to iOS labels Nov 18, 2024
@vilindberg vilindberg changed the title Tab Navigator with enableFreeze: useSharedValue resets to initialValue between screens Bridgeless with enableFreeze: useSharedValue resets to initialValue when navigating between screens Nov 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Platform: iOS This issue is specific to iOS Repro provided A reproduction with a snippet of code, snack or repo is provided
Projects
None yet
Development

No branches or pull requests

1 participant