r.g.__reanimatedWorkletInit is not a function in expo snack

Please provide the following:

  1. SDK Version: 46
  2. Platforms(Android/iOS/web/all): all
  3. react native reanimated error r.g.__reanimatedWorkletInit is not a function.

My apps is correctly working on my laptop. I am using VScode editor in my laptop where my expo version is 5.4.12 . there my apps is running well and run it successfully on my device. but the all the same codes I copied to expo snack. but shows me the error r.g.__reanimatedWorkletInit is not a function

I can’t find any solution for it.

error details below

r.g.__reanimatedWorkletInit is not a function
TypeError: r.g.__reanimatedWorkletInit is not a function
at t.Z (@react-navigation/drawer.js:3:90814)
at co ([snack internals]
at nl ([snack internals]
at Zl ([snack internals]
at Xl ([snack internals]
at Kl ([snack internals]
at Ll ([snack internals]
at _a ([snack internals]
at Ol ([snack internals]
at Uo (https://snack-web-player.s3.us-west-1.amazonaws.com/v2/46/static/js/2.5648d2a4.chunk.js:2091:2159580)

anyone face this issue on expo snack ?

Hey @rubelamin,

The question was already asked a few weeks back. Please see the solution here: Expo Snack a.g.__reanimatedWorkletInit is not a function. - #2 by amanhimself

You’ll need to add a polyfill as described in the above post.

Hi,
Thanks for your reply.

I was added that from your answer of that question but not solved.
you answered the problem for a.g.__reanimatedWorkletInit is not a function

but my problem is r.g.__reanimatedWorkletInit is not a function

not a.g.__

regards,
Rubel Amin

Ah my bad! I didn’t catch the r.g.__ part.

Can you share the a reproducible snack example on where you are getting this error? I’m trying to understand which library is throwing the exception and how we can improve the polyfill.

there is nothing any other warning.

Can you please write your email address?

I want to send my snack URL .
Actually the whole codes I have uploaded with my custom API also.
That’s why i do not want to share my URL here.

Thanks for understanding.

That’s alright! Can you share the depenedencies list from package.json file of your snack?

Yes sure!
Below those are:

{
“dependencies”: {
“axios”: “^0.27.2”,
“moment”: “^2.29.4”,
“expo-camera”: “~12.3.0”,
“expo-sensors”: “~11.4.0”,
“expo-contacts”: “~10.3.0”,
“expo-constants”: “~13.2.3”,
“expo-status-bar”: “~1.4.0”,
“react-native-svg”: “12.3.0”,
“expo-image-picker”: “~13.3.1”,
“@ expo/vector-icons”: “^13.0.0”,
“react-native-modal”: “^13.0.1”,
“react-native-paper”: “^4.12.2”,
“expo-barcode-scanner”: “~11.4.0”,
“react-native-screens”: “~3.15.0”,
“react-native-qrcode-svg”: “",
“react-native-reanimated”: “~2.9.1”,
“@ react-navigation/drawer”: “^6.4.3”,
“@ react-navigation/native”: “^6.0.11”,
“@ react-navigation/elements”: “latest”,
“@ expo/vector-icons/Ionicons”: “^13.0.0”,
“react-native-step-indicator”: “^1.0.3”,
“react-native-gesture-handler”: “~2.5.0”,
“@ react-navigation/bottom-tabs”: "
”,
“@ react-navigation/native-stack”: “^6.7.0”,
“react-native-safe-area-context”: “4.3.1”,
“@ react-native-async-storage/async-storage”: “~1.17.3”
}
}

Seems like creating and adding the polyfill is working. Here is snack example that contains all dependencies using the exact versions you shared: moody truffles - Snack

You will have to import the polyfills.ts file at the top of the App.js file in the snack:

import './polyfills';

// rest of the code

May be the r.g. and a.g. part is some internal reference to the error stack references which I can understand might be confusing but can also be related to the nature of library (since the library in the example i shared previously was using bottom-sheets and here it was caused by @react-navigation/drawer).

Okay Thank you for details.
I am trying it now.
I will inform you soon

Yes!
it’s working fine.

It was my misunderstand.
I did not import it to my App.js file.
I did not catch sentence on that answered before.

It was a big mistake from me.

Thank you for your kindness support :slight_smile:

1 Like

No worries at all :smiley: Happy that it got resolved :raised_hands:

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.