2

i have a promblem with React-native-Reanimated.
I received "Reanimated 2 failed to create a worklet, maybe you forgot to add Reanimated's babel plugin?, js engine: hermes" But I've already followed https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/installation enter image description here

Here is my version in reanimated:

"react-native-reanimated": "^2.3.0"

Here is my babel.config.js

module.exports = {
  presets: ['module:metro-react-native-babel-preset'],
  plugins: ['react-native-reanimated/plugin'],
};

Please help me to solve this problem. Thank you very much

Drew Reese
  • 165,259
  • 14
  • 153
  • 181
Chen Triều
  • 79
  • 2
  • 6
  • I was having the same problem today, turns out my babel config didn't contain `plugins: ['react-native-reanimated/plugin'],`, so it worked after adding it! – dev1ce Dec 15 '21 at 19:50
  • i've already add it, but it is run now, just... don't know what happen – Chen Triều Dec 16 '21 at 03:20
  • Does this answer your question? [Reanimated 2 failed to create a worklet, maybe you forgot to add Reanimated's babel plugin?](https://stackoverflow.com/questions/67130651/reanimated-2-failed-to-create-a-worklet-maybe-you-forgot-to-add-reanimateds-ba) – Anton Layla Jan 31 '22 at 10:45

1 Answers1

1

If you are using expo, instead of installing using npm use:

expo install react-native-reanimated

In the babel.config.js use it like this:

module.exports = function(api) {
  api.cache(true);
  return {
    presets: ['babel-preset-expo'],
    plugins: ['react-native-reanimated/plugin'],
  };
};
Jose Bernardo
  • 119
  • 1
  • 7