Using SharedValue.set() fails with 'Tried to synchronously call a non-worklet anonymous function on the UI thread.' when mixing with `with*` helpers
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
- Update to 3.16.0
- use
.setwith awithDelay(style) helper - 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
I'm getting the same thing
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.
This shouldn't happen. I'll investigate.
Hey! 👋
The issue doesn't seem to contain a minimal reproduction.
Could you provide a snack or a link to a GitHub repository under your username that reproduces the problem?
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?
@chrisnojima @gaearon @g-siedlecki @contactsimonwilson We have just released 3.16.2 which has a fix for that.