天天看點

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

繼續閱讀