2

I am creating a new react native app using react-navigation.

Every time I do npm install --save react-navigation, I see a set of warnings related to react-native-gesture-handler. I am creating a brand new app using react-native init Test and the next step was to install react-navigation.

Following are the warnings and error:

npm WARN jest-resolve@24.5.0 requires a peer of jest-haste-map@^24.0.0 but none is installed. You must install peer dependencies yourself.

npm WARN jest-resolve-dependencies@24.5.0 requires a peer of jest-haste-map@^24.0.0 but none is installed. You must install peer dependencies yourself.

npm WARN jest-snapshot@24.5.0 requires a peer of jest-haste-map@^24.0.0 but none is installed. You must install peer dependencies yourself.

npm WARN react-navigation-drawer@1.3.0 requires a peer of react-native-gesture-handler@^1.0.12 but none is installed. You must install peer dependencies yourself.

npm WARN react-navigation-stack@1.1.1 requires a peer of react-native-gesture-handler@^1.0.0 but none is installed. You must install peer dependencies yourself.

npm WARN @react-navigation/native@3.3.0 requires a peer of react-native-gesture-handler@* but none is installed. You must install peer dependencies yourself.

On importing the library in my code and running on an iOS simulator, I get an error as follows:

Failed to load bundle(http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false) with error:(Unable to resolve module `react-native-gesture-handler` from `Documents/Code/Test/node_modules/@react-navigation/native/src/Scrollables.js`: Module `react-native-gesture-handler` does not exist in the Haste module map

I tried deleting node_modules folder in my app and ran 'npm install' and 'npm install --save react-navigation' again, but that did solve the issue.

Requesting advice.

Michal
  • 2,078
  • 23
  • 36
AngelaD
  • 21
  • 4

2 Answers2

4

After creating new app, install react-navigation library then you need to install react-native-gesture-handler and also link the library.

Step1 : react-native init test//your app name
Step2 : npm install --save react-navigation
Step3 : npm install --save react-native-gesture-handler
Step4 : react-native link react-native-gesture-handler
Brijesh Shiroya
  • 3,323
  • 1
  • 13
  • 20
0

I followed Brijesh's suggestions and had to also manually import the library in my Xcode project. Here are the steps I followed:

Step1 : react-native init test//your app name

Step2 : npm install --save react-navigation

Step3 : npm install --save react-native-gesture-handler

Step4 : react-native link react-native-gesture-handler

Step5 : Right Click Libraries in Xcode "Add Files to Project"

Step6 : /node_modules/react-native-gesture-handlers/ios/RNGestureHandler.xcodeproj

Step7 : Go to build phases and add libRNGestureHandler.a

This fixed it.

AngelaD
  • 21
  • 4