Error: Unable to resolve module `react-native-gesture-handler`

hhh picture hhh · Mar 26, 2019 · Viewed 138.6k times · Source

I try to use navigate in react-native.. I added : npm install --save react-navigation

but it gives me an error like this :

error: bundling failed: Error: Unable to resolve module react-native-gesture-handler from C:\reactnative\proejectName\node_modules\@react-navigation\native\src\Scrollables.js: Module react-native-gesture-handler does not exist in the Haste module map

this is index :

import { AppRegistry } from 'react-native';
import App from './App';
import { name as appName } from './app.json';

AppRegistry.registerComponent(appName, () => App);

This is app.js

import React from 'react';
import { createStackNavigator, createAppContainer, } from 'react-navigation';
import First from './src/Components/First';
import DescriptionPage from './src/Components/DescriptionPage';


const Navigation = createStackNavigator({
  First: {
    screen: First,
  },
  DescriptionPage: {
    screen: DescriptionPage,
  },
});

const App = createAppContainer(Navigation);

export default App;

this is package.json :

{
  "name": "ProjectName",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "start": "node node_modules/react-native/local-cli/cli.js start",
    "test": "jest"
  },
  "dependencies": {
    "react": "16.8.3",
    "react-native": "0.59.1",
    "react-native-sqlite-storage": "^3.3.10",
    "react-navigation": "^3.5.1"
  },
  "devDependencies": {
    "@babel/core": "7.4.0",
    "@babel/runtime": "7.4.2",
    "babel-jest": "24.5.0",
    "eslint-config-rallycoding": "^3.2.0",
    "jest": "24.5.0",
    "metro-react-native-babel-preset": "0.53.1",
    "react-test-renderer": "16.8.3"
  },
  "jest": {
    "preset": "react-native"
  }
}

Answer

Suraj Malviya picture Suraj Malviya · Mar 26, 2019

You need to install react-native-gesture-handler as well separately in the project dependency list and link it too with native as well. Please refer to this doc.