react native 错误总结(不定时更新)

update20171101

1:lineHeight in shadow node of type:TCTText

错误截图:


原因:lineHeight只能设置成整数 

可以使用parseInt(23.7)进行取整操作
 

2:React native 打包Android时报错

执行cd android && ./gradlew assembleRelease任务错误

* What went wrong:

Execution failed for task ':app:bundleReleaseJsAndAssets'.

> A problem occurred starting process 'command 'node''

或者

* What went wrong:

Execution failed for task ':app:recordFilesBeforeBundleCommandDebug'.

> A problem occurred starting process 'command 'node''

这个错误的可能原因是gradle deamon的缓存问题,关掉cradle deamon,重新再执行一次就可以解决。

$ ./gradlew --stop

3:

原因:语法错误

    constructor(props) {
        super(props);
        return {
            message: 'Please input your password.',
            status: 'normal'
        }
    }

改为:

    constructor(props) {
        super(props);
        this.state = {
            message: 'Please input your password.',
            status: 'normal'
        }
    }

4:


这是因为link 了两次命令导致的 

在android/setting.build下删除重复的 

在android/app/build.gradle里面删除重复的即可

在android/app/src/main/java/MainApplication

getPackages方法删除重复


5:
 PropTypes错误引用方式发生变化 如下引用
 import PropTypes from 'prop-types';
 static propTypes = { //需要的类型
        cx: PropTypes.xxx.isRequired,
    };
  static defaultProps = {
        cx: 0, //类型默认值
    };




  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值