I read all docs and know the third parameter of withTiming, withSpring is an end callback of animation.
But when I try to set a state of React hook from useState, then the error is invoked.
I understand what is the problem in the thread level. currently, it seems there is no way to update JS state from UI state even if directing as a worklet; or using runOnJS.
Is there any way? Thank you.
"react": "16.13.1",
"react-native": "0.63.3",
"react-native-reanimated": "2.0.0-alpha.9.1",
"react-native-redash": "15.11.1",
Hello!
Congratulations! Your issue passed the validator! Thank you!
Define state change callback on the React side and then execute that callback using runOnJS inside the animation's callback like so:
withTiming(1, null, () => {
runOnJS(setStateCallback)();
})
Thank you for your answer. +1
@terrysahaidak how do u pass arguments to runOnJS function.
sorry: nevermind.
runOnJS(setStateCallback)(args)
Most helpful comment
Define state change callback on the React side and then execute that callback using runOnJS inside the animation's callback like so: