0

我正在尝试构建一个非常简单的 react-native 应用程序来测试反应导航。在我安装 react-navigation 并加载以下代码之前,它工作正常。

import { StackNavigator } from 'react-navigation';

运行时,它给了我消息“无法从 'Users/me/Desktop/Code/flexbox/node_modules/react-navigation/src/views/Header.js' 中解析模块 'react/lib/ReactComponentWithPureRenderMixin'...”尽管当我手动导航到该位置时该文件实际上存在于该位置。我已经尝试过清除守望者,删除/重新安装模块,并多次重置打包程序缓存。有什么想法吗?我的 package.json 下面。

{
  "name": "flexbox",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "start": "node node_modules/react-native/local-cli/cli.js start",
    "test": "jest"
  },
  "dependencies": {
    "react": "16.0.0-alpha.6",
    "react-native": "0.43.3",
    "react-navigation": "^1.0.0-beta.7"
  },
  "devDependencies": {
    "babel-jest": "19.0.0",
    "babel-preset-react-native": "1.9.1",
    "jest": "19.0.2",
    "react-test-renderer": "16.0.0-alpha.6"
  },
  "jest": {
    "preset": "react-native"
  }
}
4

1 回答 1

1

您需要将依赖项更改为此

{
    "react": "16.0.0-alpha.6",
    "react-native": "0.43.3",
    "react-navigation": "git+https://github.com/react-community/react-navigation.git#7edd9a7"
}

如本票所述:https ://github.com/react-community/react-navigation/issues/923

于 2017-04-18T06:45:50.307 回答