Error: Unable to resolve module `react-native-gesture-handler`
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"
}
}
Solution 1:
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.
Solution 2:
Use the following command to install
yarn add react-native-gesture-handler
Then link the library in the specific project
react-native link react-native-gesture-handler
Solution 3:
Gesture Handler not found in your react native project. run this command
npm install react-native-gesture-handler
Solution 4:
In my case react-native-gesture-handler
was installed but I uninstalled it and re-installed again.
1: uninstall
npm uninstall react-native-gesture-handler --save
2: install
npm install react-native-gesture-handler --save
3: link
react-native link react-native-gesture-handler
4: Restart npm
npm restart
or
npm start