(RN)基于react-native-fast-image的占位图片组件

react-native-fast-image >= 5.1.2

1.导入:

npm install --save react-native-cz-image-placeholder


2.使用:

import ImagePlaceholder from 'react-native-cz-image-placeholder';


3.参数说明:

defaultSource: 默认图: require('./images/xxx.png')

url: 图片地址: ''

width: 图片宽: 100

height: 图片高: 100

style: 图片样式: {borderRadius: 50}

headers: 图片headers: {"x": "y"}

priority: 图片下载优先级: CZImagePlaceholder.priority.normal

cache: 下载缓存策略: CZImagePlaceholder.cacheControl.immutable

resizeMode: 图片显示类型: CZImagePlaceholder.resizeMode.contain


func:

evaluateView: 赋值当前对象 { (imagePlaceholder) => {this.imagePlaceholder = imagePlaceholder}}

onLoadStart: 开始下载网络图片

onLoad: 下载成功

onError: 下载失败

onLoadEnd: 加载完成,无论成功失败都会调用


export func:

modifyImageUrl: 更换图片地址

最后编辑于 :
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

友情链接更多精彩内容