Error: Failed to create a worklet. Did you forget to add Reanimated Babel plugin in babel.config.js?

Error: Failed to create a worklet. Did you forget to add Reanimated Babel plugin in babel.config.js?

If you are trying to implement a React Native Drawer Navigator and encounter the error 'Error: Failed to create a worklet. Did you forget to add Reanimated Babel plugin in babel.config.js?', here is a quick fix for Expo.

Error on Web:

Error on Mobile:

Solution:

Step 1: Ensure That Reanimated Babel Plugin Is Added to babel.config.js

Note that in babel.config.js, the react-native-reanimated/plugin should be added, and it must be the last element in the array.

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

Step 2:Restart Your Expo Server

Stop your Expo server (Ctrl+C), and then run the command below:

expo r -c

This will fix the issue. I hope it works for you. Feel free to comment and let me know if it worked for you. Thanks for reading. We can connect on X or LinkedIn.