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

Using SharedValue.set() fails with 'Tried to synchronously call a non-worklet anonymous function on the UI thread.' when mixing with with* helpers #6613

Closed
chrisnojima opened this issue Oct 18, 2024 · 6 comments · Fixed by #6715
Assignees
Labels
Platform: iOS This issue is specific to iOS Repro provided A reproduction with a snippet of code, snack or repo is provided

Comments

@chrisnojima
Copy link

Description

I'm switching my code from using the old style opacity.value = withDelay... to opacity.set(withDelay... but this fails.
Instead it only works if i use the callback form opacity.set(() => withDelay.... Unclear if this is by design but it was definitely confusing

Steps to reproduce

  1. Update to 3.16.0
  2. use .set with a withDelay (style) helper
  3. see a red box error

Snack or a link to a repository

sorry

Reanimated version

3.16.0

React Native version

0.75.4

Platforms

iOS

JavaScript runtime

None

Workflow

None

Architecture

Paper (Old Architecture)

Build type

None

Device

None

Device model

No response

Acknowledgements

Yes

@github-actions github-actions bot added Platform: iOS This issue is specific to iOS Missing repro This issue need minimum repro scenario labels Oct 18, 2024
@contactsimonwilson
Copy link

I'm getting the same thing

@g-siedlecki
Copy link

I'm also wondering if this is a bug.
I created a minimal reproduction repo: https://github.com/g-siedlecki/ReanimatedRepro
Running React Native 0.75.4 and Reanimated 3.16.1. Tested on both iOS and Android.

@github-actions github-actions bot added Repro provided A reproduction with a snippet of code, snack or repo is provided and removed Missing repro This issue need minimum repro scenario labels Nov 5, 2024
@tjzel tjzel self-assigned this Nov 5, 2024
@tjzel
Copy link
Collaborator

tjzel commented Nov 5, 2024

This shouldn't happen. I'll investigate.

@github-actions github-actions bot added Missing repro This issue need minimum repro scenario and removed Repro provided A reproduction with a snippet of code, snack or repo is provided labels Nov 5, 2024

This comment was marked as spam.

@tjzel tjzel added Repro provided A reproduction with a snippet of code, snack or repo is provided and removed Missing repro This issue need minimum repro scenario labels Nov 5, 2024
@gaearon
Copy link
Contributor

gaearon commented Nov 15, 2024

We're adding set(() => ...) everywhere to work around this, seems to repro very consistently. Not sure if there's a risk that something deeper is broken and migrating to set() is actually a bad idea?

gaearon added a commit to bluesky-social/social-app that referenced this issue Nov 15, 2024
gaearon added a commit to bluesky-social/social-app that referenced this issue Nov 17, 2024
* Convert lightbox to get/set

* Work around software-mansion/react-native-reanimated#6613

* Use get/set in more places

* Port MainScrollProvider to get/set

* Port more to get/set

* Port composer to get/set

* Remove unnecessary thread hops in composer

* Port more things to get/set

* Convert more to get/set, remove redundant runOnJS

* Convert remaining cases to get/set
@tjzel tjzel linked a pull request Nov 17, 2024 that will close this issue
github-merge-queue bot pushed a commit that referenced this issue Nov 19, 2024
## Summary

When I added compiler-safe API for shared values, I accidentally forgot
that animations exist and that their assignment to shared values has to
be handled separately.

Fixes
 - #6613

## Test plan

Added relevant runtime test suite and adjusted some others.
tjzel added a commit that referenced this issue Nov 20, 2024
## Summary

When I added compiler-safe API for shared values, I accidentally forgot
that animations exist and that their assignment to shared values has to
be handled separately.

Fixes
 - #6613

## Test plan

Added relevant runtime test suite and adjusted some others.
@tjzel
Copy link
Collaborator

tjzel commented Nov 20, 2024

@chrisnojima @gaearon @g-siedlecki @contactsimonwilson We have just released 3.16.2 which has a fix for that.

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

Successfully merging a pull request may close this issue.

5 participants