software-mansion / react-native-gesture-handler

Declarative API exposing platform native touch and gesture system to React Native.
https://docs.swmansion.com/react-native-gesture-handler/
MIT License
6.05k stars 973 forks source link

Error with reanimatedWorkletInit #2090

Closed DorelisMarcelo closed 2 years ago

DorelisMarcelo commented 2 years ago

Hi, i am facing some issue with __reanimatedWorkletInit in React Native after update to expo 45.

I've seen some other reports like this, but they talk about including global.__reanimatedWorkletInit = jest.fn(); in jest-setup.js but i cannot find this file in the node_modules.

My package json looks like: { "main": "node_modules/expo/AppEntry.js", "scripts": { "start": "expo start", "android": "expo start --android", "ios": "expo start --ios", "web": "expo start --web", "eject": "expo eject", "test": "jest", "lint": "eslint . --ext .ts,.tsx --quiet" }, "dependencies": { "@expo/ngrok": "^4.1.0", "@mindinventory/react-native-tab-bar-interaction": "^2.2.1", "@native-html/transient-render-engine": "^11.2.3", "@react-native-async-storage/async-storage": "~1.17.3", "@react-native-community/masked-view": "0.1.10", "@react-native-community/netinfo": "8.2.0", "@react-navigation/bottom-tabs": "^5.9.4", "@react-navigation/drawer": "^5.12.5", "@react-navigation/native": "^5.9.4", "@react-navigation/stack": "^5.9.4", "dayjs": "^1.10.5", "eas": "^0.1.0", "expo": "^45.0.0", "expo-app-loading": "~2.0.0", "expo-av": "~11.2.3", "expo-blur": "~11.1.0", "expo-cli": "^5.3.1", "expo-constants": "~13.1.1", "expo-haptics": "~11.2.0", "expo-linear-gradient": "~11.3.0", "expo-localization": "~13.0.0", "expo-status-bar": "~1.3.0", "expo-updates": "~0.13.1", "i18n-js": "^3.8.0", "react": "17.0.2", "react-dom": "17.0.2", "react-native": "0.68.2", "react-native-calendars": "^1.1263.0", "react-native-elements": "^3.4.2", "react-native-gesture-handler": "~2.2.1", "react-native-gifted-chat": "^0.16.3", "react-native-grid-image-viewer": "^1.3.0", "react-native-htmlview": "^0.16.0", "react-native-image-modal": "^1.0.16", "react-native-keyboard-aware-scroll-view": "^0.9.4", "react-native-linear-gradient": "^2.5.6", "react-native-pager-view": "5.4.15", "react-native-paypal": "^4.1.0", "react-native-reanimated": "~2.8.0", "react-native-render-html": "^6.3.4", "react-native-safe-area-context": "4.2.4", "react-native-screens": "~3.11.1", "react-native-svg": "12.3.0", "react-native-svg-transformer": "^1.0.0", "react-native-vector-icons": "^9.0.0", "react-native-web": "0.17.7", "react-native-webview": "11.18.1" }, "devDependencies": { "@babel/core": "^7.12.9", "@react-native-community/eslint-config": "^2.0.0", "@types/i18n-js": "^3.8.1", "@types/react": "~17.0.21", "@types/react-native": "~0.67.6", "@types/react-native-calendars": "^1.505.3", "@types/react-native-htmlview": "^0.16.0", "eslint": "^7.28.0", "jest-expo": "^45.0.0", "typescript": "~4.3.5" }, "private": true, "jest": { "preset": "jest-expo", "transformIgnorePatterns": [ "node_modules/(?!(jest-)?react-native|react-clone-referenced-element|@react-native-community|expo(nent)?|@expo(nent)?/.|react-native-reanimated|react-navigation|@react-navigation/.|@unimodules/.|unimodules|sentry-expo|native-base|@sentry/.)" ] } }


And the log looks like


TypeError: global.reanimatedWorkletInit is not a function. (In 'global.reanimatedWorkletInit(_f)', 'global.__reanimatedWorkletInit' is undefined) at node_modules/react-native/Libraries/Core/ExceptionsManager.js:95:4 in reportException at node_modules/react-native/Libraries/Core/ExceptionsManager.js:141:19 in handleException at node_modules/react-native/Libraries/Core/setUpErrorHandling.js:24:6 in handleError at node_modules/@react-native/polyfills/error-guard.js:49:36 in ErrorUtils.reportFatalError at node_modules/metro-runtime/src/polyfills/require.js:203:6 in guardedLoadModule at http://192.168.1.76:19000/node_modules/expo/AppEntry.bundle?platform=android&dev=true&hot=false&strict=false&minify=false:262407:3 in global code

Invariant Violation: "main" has not been registered. This can happen if:

¿ Any advice ?

Thank you for your time :)

github-actions[bot] commented 2 years ago

Hey! 👋

It looks like you've omitted a few important sections from the issue template.

Please complete Description, Platforms, Steps To Reproduce, Snack or minimal code example and Package versions sections.

github-actions[bot] commented 2 years ago

Hey! 👋

The issue doesn't seem to contain a minimal reproduction.

Could you provide a snippet of code, a snack or a link to a GitHub repository that reproduces the problem?

chris24elias commented 2 years ago

I have the same issue

j-piasecki commented 2 years ago

Have you added Reanimated's Babel plugin to the babel.config.js?

rohanvasishth commented 2 years ago

I am having the same issue. I have added the plug-in to my babel.config.js.

j-piasecki commented 2 years ago

It may also be caused by stale cache. Can you check if running yarn --reset-cache solves the problem?