下载uri图像时本地图像需要很长时间才能加载 - React Native

local image take a long time to load when uri image are downloading - React Native

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

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

Adding image code:

<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,
    },

Example when load image by uri

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

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