You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have some Reanimated 1 code that I'm trying to convert to Reanimated 2. In the original code we use SpringUtils.makeConfigFromBouncinessAndSpeed and SpringUtils.makeDefaultConfig.
I want to use these SpringUtils methods in the new code, but it doesn't seem to be possible from within a worklet.
I thought this one would work, but I got the same issue:
Tried to synchronously call function {assign} from a different thread.
Running SpringUtils in a REPL and copy-pasting results in
I tried to search for examples of withSpring called with a SpringConfig in the repo. I only found one that was specifying a full list of config options, and it was just manually defined.
I was able to get this working by just transcribing the results from a REPL. But this feels pretty hacky.
It would be great if SpringUtils (or an alternative) was available from within worklets!
Alternately, it would be great if there was a way to construct some shared state on the JS thread and then pass it to the UI thread. I thought useSharedValue was supposed to do this, but it didn't seem to work...
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Problem
I have some Reanimated 1 code that I'm trying to convert to Reanimated 2. In the original code we use
SpringUtils.makeConfigFromBouncinessAndSpeed
andSpringUtils.makeDefaultConfig
.I want to use these
SpringUtils
methods in the new code, but it doesn't seem to be possible from within a worklet.Things I've tried
springConfig
declared at top levelThis led to an error when starting the animation:
springConfig
declared in workletThis led to an error when starting the animation:
Storing
springConfig
in a shared valueI thought this one would work, but I got the same issue:
Running
SpringUtils
in a REPL and copy-pasting results inI tried to search for examples of
withSpring
called with aSpringConfig
in the repo. I only found one that was specifying a full list of config options, and it was just manually defined.I was able to get this working by just transcribing the results from a REPL. But this feels pretty hacky.
Possible solutions
SpringUtils
(or an alternative) was available from within worklets!useSharedValue
was supposed to do this, but it didn't seem to work...Beta Was this translation helpful? Give feedback.
All reactions