null is an object evaluating 'this_onPress'
来源:互联网 发布:什么软件可以看工口 编辑:程序博客网 时间:2024/06/07 06:20
问题截图:
问题代码:
解决代码:
问题原因:
因为在运行时this指向的是TouableLighLight这个组件,这个组件并没有_onPress这个函数,所以会报错,
我们只需要在构造函数中绑定这个函数到当前组件即可解决这个问题,
建议以后写代码时将函数都在构造函数中进行绑定以免不必要的错误。
注意这里两个函数都要绑定 否则还是会报错。
0 0
- null is an object evaluating 'this_onPress'
- null is not object evaluating ('_this3_selectRow')
- React Native开发坑之null is not an object (evaluating 'inst.componentWillReceiveProps')
- 运行React Native示例出现null is not an object (evaluating 'this.state.text')
- 【ReactNative】undefined is not an object(evaluating 'this.props.navigator')
- undefined is not an object(evaluating 'this._component.getScrollableNode')
- undefined is not an object (evaluating 'this.props.navigator.push')
- undefined is not an object (evaluating 'dataSource.rowIdentities')
- [ReactNative]undefined is not an object (evaluating 'ImagePickerManager.showImagePicker')
- ReactNative报错:undefined is not an object(evaluating 'RCTCameraRollManager.getPhotos')
- React Native 出现undefined is not an object (evaluating 'this.props.navigator')
- React-Native 0.43.4 undefined is not an object (evaluating '_props[registrationName]') 正确的解决姿势
- React Native报错unddefined is not an object(evaluating ‘_reactnative.propTypes’)解决办法
- undefined is not an object (evaluating 'this.props.nav.push')的解决过程
- dojo.widget' is null or not an object
- 【JS】null是用来表示对象的(null is as a placeholder for an object)
- Everything Is an Object
- Everything Is an Object
- 剑指Offer面试题21:包含min函数的栈
- 留坑 DP
- 仿豌豆荚Smart锁屏,MIUI7直跳辅助功能设置
- 微微一笑
- RecyclerView万能适配器,点击事件,分割线,间距等写法
- null is an object evaluating 'this_onPress'
- 论文写作
- Java多线程 -- JUC包源码分析17 -- 弱一致性与无锁队列
- 单例模式
- log4j日志配置
- Spring3.2.2中相关Jar包的作用
- android crash处理
- nyoj21三个无标量水杯
- 查看80端口占用