日常报错记录

1. Json Value’’of type NSNull cannot be cover

原因image中的uri为null

判断image中的显示

AsyncStorage.setItem('firebaseUser', JSON.stringify(data))

2. cannot find module‘@babel/plugin-propesd-decoraters’from‘…..’

未在ios项目中pod 

先npm install再pod install

3. unable to find module for eventdispatcher

需重新react-native run-ios

4.no bundle

需react-native run-ios

5. yarn start --reset-cache

Wrong version of Flow. The config specifies version ^0.45.0 but this is version 0.49.0 Could not start Flow       server!

需  npm install flow-bin@0.45.0 -g

6. React-native-swiper组件

直接map是不会滚动的,需要在render里用{this.renderSwiper()}用for循环遍历出来

7.定义全局变量 在app.js里

    constructor(props){

      super(props);

//这里添加globel方法

global.arrData =[];

    }

在全局可以直接调用arrData数组 可以直接对arrData操作

8.Unable to load script.Make sure you're either running a metro server(run 'react-native start')or that your bundle 'index.android.bundle' is packaged correctly for release.

中文翻译:无法加载脚本。请确保您运行的是Metro服务器(运行'react-native start')或者您的软件包'index.android.bundle'已正确打包以供发布

1. 检查index.android.bundle这个文件是否存在  在编辑器里全局搜了这个文件没有找到

2. 需要在 项目中在android/app/src/main/创建文件夹assets 然后在项目根目录下执行命令

react-native bundle --platform android --dev false --entry-file index.android.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res

9.TextInput  设置editable={false}为不可点击

10.unhandled JS Exception: Requiring unknown module "49". if you are sure the module is there

更新代码并npm install后只是reload了没有重启服务导致

重启服务即可

11.Invariant Violation: Invariant Violation: Tried to get frame for out of range index NaN;

出现这种错误的主要原因是ListView的数据源为空,你可以按照数据源的赋值过程查找

12.push 数组重复问题

需要在循环内部定义对象并push

https://blog.csdn.net/u012746918/article/details/92622420

13.去掉滚动条

showsVerticalScrollIndicator = {false}//隐藏纵向滚动条

14.添加延时

 setTimeout(()=> {

            this.setState({ isAble:true })

        },2000);

15. 坑了几天的日期组件英文显示

通过locale="Chinese”搞定了

16.Android极光分享微信上图片不显示的问题 需要先把图片下载到本地再从本地读取静态路径

https://community.jiguang.cn/question/322210?fs=1

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容