反应导航 1.0.0-beta.7 破坏应用程序

react-navigation 1.0.0-beta.7 breaking app

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

import { StackNavigator } from 'react-navigation';

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

您需要将您的依赖更改为此

{
    "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