我尝试在react-native中使用Navigation。 npm install --save react-navigation
但是它给我这样的错误:
错误:捆绑失败:错误:无法解析模块react-native-gesture-handler
从C:\reactnative\proejectName\node_modules\@react-navigation\native\src\Scrollables.js
:模块react-native-gesture-handler
不会在急速模块地图存在
这是索引:
import { AppRegistry } from 'react-native';
import App from './App';
import { name as appName } from './app.json';
AppRegistry.registerComponent(appName, () => App);
这是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;
这是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"
}
}
package.json
长什么样?