我正在尝试构建一个非常简单的react-native应用程序来测试反应导航。它工作正常,直到我安装react-navigation并加载以下代码。
import { StackNavigator } from 'react-navigation';
运行时,它会显示“无法解析模块”的消息 'react / lib / ReactComponentWithPureRenderMixin'来自'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"
}
}
答案 0 :(得分: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