加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

记录学习RN遇到的报错

发布时间:2020-12-15 07:17:06 所属栏目:百科 来源:网络整理
导读:格式:【描述】 【截图】 【解决】 【参考】 ios android 关键词:override 【描述】 Native module VectorIconsModule tried to override VectorIconsModule for module name RNVectorIconsModule. If this was your intention,set canOverrideExistingModu

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

ios

android

关键词:override

【描述】

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

【截图】

【解决】

找到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...

【截图】

【解决】

<View ref={"abcd"}/>  

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

改成:

myRefs = {
    abcd: null
}

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

this.myRefs.abcd

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读