ReactNative常见错误

1Unable to load script from assets index.android.bundle on windows

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

2 Invariant Violation: requireNativeComponent: "BVLinearGradient" was not found in the UIManager

image.png
#package.json下执行
npm install react-native-linear-gradient --save

#ios Podfile
pod 'BVLinearGradient', :path => '../node_modules/react-native-linear-gradient'

3 Invariant Violation: Tried to get frame for out of range index NaN

image.png

flatlist 数据源data数据json结构不是数组对象

4 RN的view拖拽失效

image.png

[5 Runtime is not ready for debugging!]

5.png

解决方案:
重启mac

[6 Image source size {42, 32} does not match loaded image size {21, 16}]

image.png

解决方案:
检查资源文件a
a@2x.png分辨率不是a.png的两倍,修改资源文件确保@2x是其两倍,@3x分辨率是其三倍之后,问题解决。

https://www.jianshu.com/p/57ed76e90605

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

推荐阅读更多精彩内容