记录学习RN遇到的报错

格式:【描述】 【截图】 【解决】 【参考】

ios

关键词:EMFILE

【描述】

ERROR Error watching file for changes: EMFILE
{"code":"EMFILE","errno":"EMFILE","syscall":"Error watching file for changes:","filename":null}
Error: Error watching file for changes: EMFILE

at _errnoException (util.js:1041:11)
at FSEvent.FSWatcher._handle.onchange (fs.js:1359:9)

【截图】

图片描述

【解决】

升级最新MacOS系统后,需要重新安装一次brew install watchman

或者

需要安装watchman

git clone https://github.com/facebook/w...
cd watchman
./autogen.sh
./configure
make
sudo make install

【参考】

https://segmentfault.com/q/10...

android

关键词:override

【描述】

Native module VectorIconsModule tried to override VectorIconsModule for module name RNVectorIconsModule. If this was your intention, set canOverrideExistingModule=true

【截图】

clipboard.png

【解决】

找到MainApplication.java(android/app/src/main/java/com),里面有有重复的引用,把重复的部分删除就行了

import com.oblador.vectoricons.VectorIconsPackage;// 删除
...
public class MainApplication extends Application implements ReactApplication {
    ...
    new VectorIconsPackage(), // 删除
}

【参考】

https://stackoverflow.com/que...

关键词:refs

【描述】

addComponentAsRefTo(...): Only a ReactOwner can have refs. You might be adding a ref to a component that was not created inside a component's render method, or you have multiple copies of React loaded (details: https://fb.me/react-refs-must...

【截图】

clipboard.png

【解决】

<View ref={"abcd"}/>  

this.refs.abcd    // 如果在rander之外使用ref就会报错报错

改成:

myRefs = {
    abcd: null
}

<View ref={(abcd) => {this.myRefs.abcd = abcd}}>

this.myRefs.abcd
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值