美文网首页
(RN)基于react-native-fast-image的占位

(RN)基于react-native-fast-image的占位

作者: 終于 | 来源:发表于2018-12-31 18:39 被阅读0次

    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: 更换图片地址

    相关文章

      网友评论

          本文标题:(RN)基于react-native-fast-image的占位

          本文链接:https://www.haomeiwen.com/subject/cqrwlqtx.html