天天看点

React.createElement: type is invalid -- expected a string (for built-in components) or a class/funct

React.createElement: type is invalid -- expected a string (for built-in components) or a class/funct

版本信息:

“react”: “16.0.0-alpha.12”,

“react-native”: “0.46.4”,

“react-navigation”: “^1.0.0-beta.11”

node:8.0.0

npm:5.0.1

这是版本问题最后无奈只能降低版本。

如果是已经在项目中用了react-navigation那么升级后是没有这个问题的。

如果是新建项目然后使用react-navigation那就会有这个问题。

然后将新项目降级到0.44 删除node_module 使用npm i. 运行还是会报错。

再次删除node_module

运行yarn install.

一切OK。

降级后的版本:

“react”: “16.0.0-alpha.6”,

“react-native”: “^0.44.0”,

“react-navigation”: “^1.0.0-beta.11”

issue:

https://github.com/react-community/react-navigation/issues/2197

https://github.com/react-community/react-navigation/issues/2177

https://segmentfault.com/q/1010000010286008

继续阅读