react-native-redash: reanimated workletInit is not a function

Trying to follow along with the gestures tutorial to create a draggable view and I get the following error when trying to use the usePanGestureHandler hook.

TypeError: global.__reanimatedWorkletInit is not a function. (In 'global.__reanimatedWorkletInit(_f)', 'global.__reanimatedWorkletInit' is undefined)

I see there’s an issue in reanimated related to this, do I need to downgrade?

Package versions are:

"react-native-reanimated": "^2.0.0-alpha.9.1",
"react-native-redash": "^15.11.1"

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 23 (5 by maintainers)

Most upvoted comments

Thanks to this post, simply adding import 'react-native-reanimated'; on top of the file solved my issue.

This issue is happening on Web in v2.8.0.

@nandorojo and for those of you running into the problem v2.8.0 on web, I was able to resolve the issue by adding global.__reanimatedWorkletInit = () => {}; to /lib/reanimated2/core.js Note that it is the lib folder and not the src folder that made it work.

Start metro with cache reset yarn start --reset-cache

This helped me solve the problem

For me putting import for react-native-reanimated before import for redash solved the issue

Hi,

I am having the exact same issue, but I cannot make that workaround work. Where I am supposed to put this function?

global.__reanimatedWorkletInit = () => {};

Thanks!