React-navigation 在React-native 升级到0.43报错的解决办法

报错信息为UnableToResolveError: Unable to resolve module react/lib/ReactComponentWithPureRenderMixin from /node_modules/react-navigation/src/views/Header.js
原因: Header.js中引入了ReactComponentWithPureRenderMixin,但后面未发现对这个引入的使用。

1.办法一:
"react": "16.0.0-alpha.3", "react-native": "0.43.2", "react-navigation": "git+[https://github.com/react-community/react-navigation.git#7edd9a7](https://github.com/react-community/react-navigation.git#7edd9a7)"
把package.json改成上面的版本 把node-modules 文件夹删除,再npm install .

2.办法二:
将header.js第12行的代码

import ReactComponentWithPureRenderMixin from 'react/lib/ReactComponentWithPureRenderMixin';
删除

详见 https://github.com/react-community/react-navigation/issues/923

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容