Crash if using scheduleOnRN but not runOnJS #8811
-
|
Here's the snippet: useAnimatedReaction(
() => isDragging.value,
(curr) => {
// This line causes the crash
// scheduleOnRN(() => setPressed(curr ? true : false))
// This works great
runOnJS(setPressed)(curr ? true : false)
}
)
Not sure if this is worth opening a full issue. I'm using an iPhone 16 Plus Simulator running iOS 18.5 on a M1 Macbook Pro. Here are my dependencies: Love this library! Let me know if I can help or what I might be doing wrong. Thanks. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
|
Functions passed to scheduleOnRN must be defined in the RN Runtime scope, i.e. in the component body or the global scope. |
Beta Was this translation helpful? Give feedback.
Functions passed to scheduleOnRN must be defined in the RN Runtime scope, i.e. in the component body or the global scope.
The code below won't work because myFunction is defined in the runOnUI callback, which is only executed in the UI Runtime: