blog bg

September 04, 2023

Failed to initialize react-native-reanimated library in React-Native

Share what you learn in this blog to prepare for your interview, create your forever-free profile now, and explore how to monetize your valuable knowledge.

Recently, I was working on a React Native project, where I had to use Drawer navigation to open and close the sidebar menu. I followed the official documentation to install the Drawer Navigator to my Project And my Drawer Navigation Will look like following image

However, When I tried to run the project after I install the drawer navigation. I started getting following error as shown in below image

ERROR Error: Failed to initialize react-native-reanimated library, make sure you followed installation steps here

This is the common issue when we are working on  Drawer Navigation in React Native with Expo.

To Solve the Issue, we need to follow two steps.

1.Edit babel.config.js file

   Initially, File will looks like this,

module.exports = function (api) {
  api.cache(true);
  return {
    presets: ["babel-preset-expo"]
  };
};

   we need to update babel.config.js file to make drawer navigator to work

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

    After that stop the server if running and we need to clear the cache.

2. Run following command to clear cache in expo

expo start -c

Once we followed the two steps listed above, then re-start the server. Drawer Navigator will work as expected

GOOD LUCK.. 

 

 

 

 

220 views

Please Login to create a Question