Reanimated 2 crash

I’m trying to test Reanimated 2 but am getting a component exception after the splash screen:

Reanimated 2 failed to create a worklet, maybe you forgot to add Reanimated's babel plugin?

But I’ve got the babel plugin:

module.exports = function (api) {
	api.cache(true);
	return {
		presets: ["babel-preset-expo"],
		plugins: ["react-native-reanimated/plugin"],
	};
};

package.json:

{
  "main": "index.js",
  "scripts": {
    "android": "react-native run-android",
    "ios": "react-native run-ios",
    "web": "expo start --web",
    "start": "react-native start",
    "test": "node_modules/.bin/jest",
    "test:debug": "node --inspect-brk node_modules/jest/bin/jest.js --runInBand"
  },
  "dependencies": {
    "@nandorojo/swr-react-native": "^0.1.3",
    "@react-native-community/datetimepicker": "3.2.0",
    "@react-native-community/masked-view": "0.1.10",
    "@react-native-community/netinfo": "6.0.0",
    "@react-native-picker/picker": "1.9.11",
    "@react-navigation/bottom-tabs": "^5.11.7",
    "@react-navigation/drawer": "^5.12.3",
    "@react-navigation/material-top-tabs": "^5.3.13",
    "@react-navigation/native": "^5.9.2",
    "@react-navigation/stack": "^5.14.2",
    "expo": "^41.0.0",
    "expo-app-loading": "^1.0.1",
    "expo-constants": "~10.1.3",
    "expo-facebook": "~11.0.5",
    "expo-file-system": "~11.0.2",
    "expo-firebase-analytics": "~4.0.2",
    "expo-font": "~9.1.0",
    "expo-google-app-auth": "^8.1.4",
    "expo-image-manipulator": "~9.1.0",
    "expo-image-picker": "~10.1.4",
    "expo-linking": "~2.2.3",
    "expo-notifications": "~0.11.6",
    "expo-random": "~11.1.2",
    "expo-secure-store": "~10.1.0",
    "expo-splash-screen": "~0.10.2",
    "expo-status-bar": "~1.0.4",
    "expo-updates": "~0.5.4",
    "expo-web-browser": "~9.1.0",
    "oddslib": "^1.0.3",
    "react": "16.13.1",
    "react-dom": "16.13.1",
    "react-native": "0.63.4",
    "react-native-appearance": "~0.3.3",
    "react-native-confirmation-code-field": "^7.0.1",
    "react-native-event-listeners": "^1.0.7",
    "react-native-gesture-handler": "~1.10.2",
    "react-native-keyboard-aware-scroll-view": "^0.9.3",
    "react-native-modal-selector-searchable": "^2.1.3",
    "react-native-phone-input": "^1.0.9",
    "react-native-reanimated": "~2.1.0",
    "react-native-safe-area-context": "3.2.0",
    "react-native-screens": "~3.0.0",
    "react-native-svg": "12.1.0",
    "react-native-swipe-gestures": "^1.0.5",
    "react-native-tab-view": "^2.15.2",
    "react-native-unimodules": "~0.13.3",
    "react-native-web": "~0.13.12",
    "react-native-wheel-scrollview-picker": "^1.0.2",
    "relative-time-react-native-component": "^5.0.2",
    "swr": "^0.4.1"
  },
  "devDependencies": {
    "@babel/core": "~7.9.0",
    "@types/react": "~16.9.35",
    "@types/react-native": "~0.63.2",
    "babel-jest": "~25.2.6",
    "jest-expo": "^41.0.0",
    "react-test-renderer": "~16.13.1",
    "typescript": "~4.0.0"
  },
  "jest": {
    "preset": "jest-expo",
    "transformIgnorePatterns": [
      "node_modules/(?!(jest-)?react-native|react-clone-referenced-element|@react-native-community|expo(nent)?|@expo(nent)?/.*|react-navigation|@react-navigation/.*|@unimodules/.*|unimodules|sentry-expo|native-base|@sentry/.*)"
    ]
  },
  "private": true
}

I’m using the example file from Reanimated - Expo Documentation. Any help appreciated!

i have the same issue as well trying to run the reanimated 2 example from the expo website. On SDK 41

3 Likes

i am also have the same issue

issues solved by my side .
1: yarn add react-native-reanimated@next // just add this library dont need to remove any library.
2:npm install -g expo-cli // update expo
3:currently the code was wrong in the expo docs use:
<Animated.View

      style={[{width:100  height: 80, backgroundColor: 'black', margin: 30 }, style]}

    />    // we dont need width it throws an error

replace with this:

<Animated.View

      style={[{  height: 80, backgroundColor: 'black', margin: 30 }, style]}

    />  //remove width because style already have width

This have worked for me

1 Like

Thanks all! The issue seems to have resolved on its own for me. I won’t question it!

You might have to take down expo and run expo r -c so that it can clear the cache before starting up again. Also, if anyone else is using multiple plugins, make sure 'react-native-reanimated/plugin' is the last one in the list