react native:Expected a component class,got [Object Object ]
注意标签符号,首字母是否有大写!!
null is not an object
在react native用到es6的时候初始化state应该在constructor ()内,而不是用getInitialState()
class Search extends Component {
constructor () {
super();
this.state = {
....
}
}
...
}
- 初始化项目后执行react-native run-ios,构建失败:
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文件,然后执行npm install。其中,pakage.json文件应该这么改:
测试版本:
"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
解决方法:在 终端执行如下命令 sudo xcode-select -s /Applications/Xcode.app/Contents/Developer/
注意:前提是你已经安装了xcode
react native45版本开始后,新建应用会抛出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
网友评论