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

Viewed 5973

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

I am using React Native (not expo). I don't even have reanimated downloaded. I had it downloaded then I removed it and rebuilt the app, and it's giving me this error now.

Things I've tried:

deleting node_modules and re-running yarn install -git reset HEAD~ to a prev commit where I didn't install the reanimated2 packages

7 Answers

I just followed the below steps to solve this issue.

step1: npx react-native run-android step2: npm start -- --reset-cache

and it solved

Ok, what I ended up doing to solve this was:

-just deleted the whole repo from my local
-cloned it again from github
-uninstalled the app from Android emulator

Then it seemed to work. So maybe it was an error related to cache or something lingering around even after I had removed all instances of the word/package "reanimated" from the whole codebase.

Using Expo in a bareworkflow

  • Clear app memory
  • run expo start --dev-client --clear

I had a require cycle warning from a git submodule inside the src folder which I thought wasn't doing any harm but turns out fixing that solved this issue. I am unsure why the require cycle was causing so much grief but I guess if you've got a require cycle in your output try solving that and it may fix this.

What I did was degrading react-native-reanimated to ^2.6.0. It solved the issue for me.

I had this problem too and simply moved the babel plugin react-native-reanimated/plugin to the last place in the babel's config as stated in the doc.

I should probably mention it worked for me before but when I started migrating the react-native app for web this was the problem for me. I am using expo. I had to run expo with --clear CLI arg as expo start --dev-client --clear.

Related