React-native 常见问题及错误解决方案

来源:互联网 发布:分层匹配追踪算法 编辑:程序博客网 时间:2024/06/06 02:52
  • 根据官方文档设置样式,不凭个人臆想
  • 当无warnning,无error时,也无逾期效果时,检查单词拼写是否有误是否
  • Image控件一定要设置大小
  • 使用原生工具一定要注意工具是否需要额外的user-permission
  • 使用原生工具时,留意是否有混合开发中的坑,比如:TextUtils这种原生中用来判断的东西,不能在混合中作为判断(重写或者删除该判断)
  • 使用其他人的轮子的时候,最好自己要跟着fuck coding熟悉一遍
  • 在组件的事件中直接使用{function()}而非{()=>{function()}}将导致function()直接调用,不会等待事件的触发
  • You should initialize state in the constructor when using ES6 classes, and define the getInitialState method when using React.createClass
  • 在单个module.exports = MyComponent后,其他文件进行import时,不能使用大括号(例如:{MyCoponent})+from ('./***/**.js'),否则,无法正常导入;
  • TouchableHighlight必须包含其他组件,不然会报error, only one simple child component
  • The development server returned response error code: 500 in react nativebabel-preset-react-native的版本问题,版本重置:
$yarn remove babel-preset-react-native$yarn add babel-preset-react-native@2.1.0
  • specified for property 'assetsDir' does not exist.,缓存引起的错误,’clean Project’后重试。
原创粉丝点击