skip to Main Content

I have tried to add this in the bable file too

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

Is there any other way to solve it

2

Answers


  1. Chosen as BEST ANSWER

    If you are using the lower version for the react-native-reanimated package

    Then add the below line in the android/build.gradlew file before the allProjects.

    subprojects { subproject ->
        if(project['name'] == 'react-native-reanimated'){
            project.configurations { compile { } }
        }
    }
    

    And remove the plugin from the babel.config.js

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

    It worked for me.


  2. I got this same error. While working with Drawer Navigator,

    Then I added the dependency "react-native-reanimated": "^3.5.4",

    Then I added the plugins in babel.config.js

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

    Then closed the metro server and cleared the cache using this command

    I am using react native cli -> So cleared the cache using this command

    npx react-native start --reset-cache
    

    And I’ve runned again the command then it is working fine

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search