Adding drawer navigator causes Module not found: Can't resolve 'react-native-reanimated' in react-native-web

Not sure if this is an Expo issue or a react-navigation issue. I thought I would ask here first.

I have a starter app (created by expo init with “tabs (TypeScript)”), and wanted to add a drawer navigator. Following the instructions from reactnavigation.org, I have done:

  • yarn add @react-navigation/drawer
  • expo install react-native-gesture-handler react-native-reanimated
  • added import 'react-native-gesture-handler'; to the top of my App.tsx
  • added plugins: ["react-native-reanimated/plugin"], to my babel.config.js
  • added a call to createDrawerNavigator() to my app

When I use expo start to run the app in Android, it runs without errors. When I run it in a browser, it bundles without errors, but fails at launch time with several messages like this:

Web Bundling complete 6242ms
./node_modules/@react-navigation/drawer/lib/module/views/DrawerView.js:22
Module not found: Can't resolve 'react-native-reanimated'

Any suggestions how to get past this problem? As far as I can tell, Expo has successfully installed react-native-reanimated 2.3.1.

I’m having the same problem, also happening only for web

1 Like

I got around it by using npm install to install react-native-reanimated 2.4.1 (instead of 2.3.1). When I run expo start, it gives me a warning about an unsupported version, but it does seem to work.

I do not know if there are any consequences of using the “wrong” version.

1 Like

Interesting, it worked also for me now. Thank you so much for the tip. I also find it weird that it works using that version. Thank you for the reply :slight_smile: