App immediately crash using runOnJS?

See original GitHub issue

app closing immediately

Expected behavior

Actual behavior & steps to reproduce

Snack or minimal code example

  const setIngredient = useCallback(() => {
    setState({
      ...state,
      [ingredient]: Math.max(...Object.values(state)) + 1,
    });
  }, [state, ingredient, setState]);
  const onGestureEvent = useAnimatedGestureHandler({
    onActive: ({ translationX, translationY }) => {
      translateX.value = translationX;
      translateY.value = translationY;
    },
    onEnd: ({ velocityY }) => {
      "worklet";

      const destination = snapPoint(translateY.value, velocityY, [
        0,
        -HEADER_HEIGHT,
      ]);
      translateX.value = withTiming(0);
      translateY.value = withTiming(0, {}, () => {
        opacity.value = 1;
      });
      if (destination !== 0) {
        opacity.value = 0;
        runOnJS(setIngredient)();
      }
    },
  });

Package versions

  • React Native: 0.64
  • React Native Reanimated: 2.1.0
  • NodeJS: v12.21.0
  • Xcode: 12.5
  • Java & Gradle:

Affected platforms

  • [ x] Android
  • [ x] iOS
  • Web

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
gpbaculiocommented, Aug 25, 2021

@jmysliv updating react + reanimated fix

0reactions
jmyslivcommented, Aug 24, 2021

Hi @gpbaculio! Are you still encounter this issue? Have you tried to upgrade reanimated to 2.3.0-alpha.2?

Read more comments on GitHub >

github_iconTop Results From Across the Web

App immediately crash using runOnJS? - Bountysource
app closing immediately. Expected behavior. Actual behavior & steps to reproduce. Snack or minimal code example.
Read more >
runOnJS automatically closes app in react native without error ...
i am not really sure why my app in android and ios just suddenly closes when runOnJS is fired, on both terminal in...
Read more >
App Center Crashes for React Native - Microsoft Learn
App Center Crashes provides you with an API to generate a test crash for easy testing of the SDK. This API can only...
Read more >
runOnJS | React Native Reanimated - Software Mansion
When you call a function on the UI thread you can't be sure if you're calling a worklet or a callback from the...
Read more >
React native app crash on review b… | Apple Developer Forums
I have tested the app on many real devices using test flight and also on simulators. Even I have tested on the same...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found