React-Native bug总结

1.React-Native run in ios 

Failed to install the requested application

An application bundle was not found at the provided path.

Provide a valid path to the desired application bundle.

Print: Entry, ":CFBundleIdentifier", Does Not Exist

Error in config:

[Error: Command failed: /usr/libexec/PlistBuddy -c Print:CFBundleIdentifier /Users/xiaotian/Desktop/ZhiHuDaily-React-Native-master/ios/build/Build/Products/Debug-iphonesimulator/RCTZhiHuDaily.app/Info.plist

Print: Entry, ":CFBundleIdentifier", Does Not Exist

]


React-Native bug总结_第1张图片

解决方法:

1、reset一下 ios模拟器

2、terminal中执行, react-native upgrade 一直enter!

3.  还是不行的话,先用xcode运行项目


2.Home.getInitialState():must return an object or null

React-Native bug总结_第2张图片

解决方法:

1.getinitialstate方法里没有初始化变量,或者在异步请求服务器数据之后才初始化变量,导致下面用到变量时根本就没有这个变量

。变量初始化一个null或在移步执行之前先初始化一个null


3.模拟器command r 没反应

shift+command+k


4,react-packager has encountered an internal error

1>终端brew upgrade watchman

2>xcode 里clean


5.react-native android 真机测试报错 no devices has found,找不到机器

1>.获取设备的厂商id


React-Native bug总结_第3张图片
React-Native bug总结_第4张图片

2>.vi ~/.android/adb_usb.ini 加上厂商id


React-Native bug总结_第5张图片

3>重启Mac

6.View` has no propType for native prop `RCTView.alignContent` of native type `YGAlign`



React-Native bug总结_第6张图片
      

解决:1>关闭当前packager server(可能是别的项目的,所以会报错)解决:关闭当前packager server(可能是别的项目的,所以会报错)

2> 开启当前项目对应的packager server


7.Element type is invalid: expected a string (for build-in components) check of App


React-Native bug总结_第7张图片

本人用redux框架,在page链接redux对应的state和action时,connect函数忘了写connect函数名了... 加上connect->ok!


export default connect (state => ({

state: state.dynamic

}),

(dispatch) => ({

actions:bindActionCreators(dynamicActions, dispatch)

})

)(Main);

总之这个错误,是没有正确返回组件

8.the development server returned response error code:500

React-Native bug总结_第8张图片

原因:

import App from'./src';

AppRegistry.registerComponent('shitoujiandaobu', () => App);


显然是App路径错了

解决:

import App from'./src/app';

AppRegistry.registerComponent('shitoujiandaobu', () => App);

9.null is not an object(evaluating'_this2.onPress')


React-Native bug总结_第9张图片

问题:this指向问题 指向的对象没有onPress方法为null

解决:记得查找每个调用方法有没有绑定this

renderRow={this.renderRow}改成:

renderRow={this.renderRow.bind(this)}

10.listview renderheader死活不显示

解决:改成renderfooter,再改回来!!!,这个问题简直奇葩!!!

你可能感兴趣的:(React-Native bug总结)