react native:Expected a component class,got [Object Object ]
注意標(biāo)簽符號苔巨,首字母是否有大寫Q!
null is not an object
在react native用到es6的時候初始化state應(yīng)該在constructor ()內(nèi)凰盔,而不是用getInitialState()
class Search extends Component {
constructor () {
super();
this.state = {
....
}
}
...
}
- 初始化項目后執(zhí)行react-native run-ios衬廷,構(gòu)建失數暌纭:
Command failed: /usr/libexec/PlistBuddy -c Print:CFBundleIdentifier build/Build/Products/Debug-iphonesimulator/xxx.app/Info.plist
Print: Entry, ":CFBundleIdentifier", Does Not Exist
更換版本
刪除node-modules文件夾呼股,修改pakage.json文件蜜暑,然后執(zhí)行npm install喂链。其中返十,pakage.json文件應(yīng)該這么改:
測試版本:
"react": "16.0.0-alpha.12",
"react-native": "0.45.0"
切換成下面的版本就可以了:
"react": "16.0.0-alpha.6",
"react-native": "0.44.3"
react-native upgrade
xcrun: error: unable to find utility "instruments", not a developer tool or in PATH
解決方法:在 終端執(zhí)行如下命令 sudo xcode-select -s /Applications/Xcode.app/Contents/Developer/
注意:前提是你已經(jīng)安裝了xcode
react native45版本開始后,新建應(yīng)用會拋出UNpackage xxxx錯誤
原因是最新的RN無法下載到4個tar.gz文件椭微,由于被墻的原因洞坑,所以要手動去下載,下載好后把下載好的四個文件放到路徑:/Users/xxx/.rncache/下面蝇率,這四個文件的下載路徑分別是:
https://codeload.github.com/facebook/folly/tar.gz/v2016.09.26.00
https://codeload.github.com/google/double-conversion/tar.gz/v1.1.5
https://codeload.github.com/google/glog/tar.gz/v0.3.4
https://github.com/react-native-community/boost-for-react-native/releases/download/v1.63.0-0/boost_1_63_0.tar.gz