【问题标题】:react-navigation 1.0.0-beta.7 breaking appreact-navigation 1.0.0-beta.7 破坏应用程序
【发布时间】:2017-04-18 05:05:57
【问题描述】:

我正在尝试构建一个非常简单的 react-native 应用程序来测试 react-navigation。在我安装 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"
  }
}

【问题讨论】:

    标签: reactjs react-native react-navigation


    【解决方案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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2015-06-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多