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" } }
React Native Gesture Handler enables you to implement highly performant gestures in React Native because it runs in the native thread and follows platform-specific behavior, which in turn leads to better performance.
react-native-screens provides native primitives to represent screens instead of plain <View> components in order to better take advantage of operating system behavior and optimizations around screens. This capability is used by library authors and unlikely to be used directly by most app developers.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With