【问题标题】:local image take a long time to load when uri image are downloading - React Native下载uri图像时本地图像需要很长时间才能加载-React Native
【发布时间】:2017-05-01 14:53:36
【问题描述】:

当我创建我的应用程序时,我放置的图像可以正常工作并正常加载。

稍后,连接到服务器,我必须通过 url 显示一些图像。作为一个大列表,有许多图像必须下载导致应用程序的所有图像(按钮、徽标等)进入一种线程,从而导致此问题。

添加图片代码:

<Image source={buttonAddToCart} style={styles.buttonIncrease} />

buttonAddToCart 是一个导入。

import buttonAddToCart from '../../assets/images/buttonAddToCart.png';

styles.buttonIncrease

buttonIncrease: {
        backgroundColor: 'transparent',
        height: 60,
        width: 60,
        marginTop: 35,
    },

uri加载图片时的示例

<Image
    source={{ uri: category.image_url }}
    style={styles.categoryPicture}/>

【问题讨论】:

  • 你能添加关于如何加载图像的代码吗?
  • @pritishvaidya 代码添加
  • 那么您是否在console 中获得了任何errors,或者它是否在重新启动 以及它与rendering small no of the images 一起使用后得到修复?
  • 控制台或任何类型都没有错误。当有许多通过 url 加载的图像时,仅作为本地路径访问的图像会花费大量时间
  • 再想一想,我想知道您是否正在使用任何模块捆绑器?

标签: javascript image react-native image-loading


【解决方案1】:

我找不到这个问题的明确解决方案,我遇到了这个 react-native-cached-image 库,它帮助我很好地掩盖了这个问题,尽管基本上问题仍然存在

【讨论】:

    猜你喜欢
    • 2012-10-26
    • 1970-01-01
    • 1970-01-01
    • 2017-08-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-06-24
    • 1970-01-01
    相关资源
    最近更新 更多