反应导航的解决方案找不到模块

时间:2019-09-15 00:23:01

标签: react-native react-navigation

enter image description here React是否有针对此问题的解决方案。真令人沮丧

没有一个可解决的解决方法。 这是我的 package.json

{
  "name": "HotelReservation",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "start": "react-native start",
    "test": "jest",
    "lint": "eslint ."
  },
  "dependencies": {
    "react": "^16.3.0-alpha.1",
    "react-native": "0.54.0",
    "react-navigation": "^1.5.1"
  },
  "devDependencies": {
    "@babel/core": "^7.6.0",
    "@babel/runtime": "^7.6.0",
    "@react-native-community/eslint-config": "^0.0.5",
    "babel-jest": "^24.9.0",
    "eslint": "^6.4.0",
    "jest": "^24.9.0",
    "metro-react-native-babel-preset": "^0.56.0",
    "react-test-renderer": "16.8.6"
  },
  "jest": {
    "preset": "react-native"
  }
}

并分类 App

import {createAppContainer} from 'react-navigation';
import {createStackNavigator} from 'react-navigation-stack';
import HomeScreen from './screens/HomeScreen'
import ProfileScreen from './screens/ProfileScreen'

const MainNavigator = createStackNavigator({
  Home: {screen: HomeScreen},
  Profile: {screen: ProfileScreen},
});

const App = createAppContainer(MainNavigator);

export default App;

我应该更新什么? 是反应问题还是反应导航错误

1 个答案:

答案 0 :(得分:0)

在您的package.json文件中,您似乎没有以下库:react-native-reanimatedreact-native-gesture-handlerreact-native-screens。如果您使用的是React Native裸项目,则需要添加这些库并链接这些库。对于React Native 0.60或更高版本,这些库将在您添加上述库后自动链接(即使用yarnnpm添加这些库)。但是,当您使用React Native 0.59时,需要手动链接依赖项。请参考本文档以添加和链接那些依赖项。它还为您提供了有关React Navigation入门的所有详细信息。