DylanVann / react-native-fast-image

🚩 FastImage, performant React Native image component.
MIT License
8.1k stars 1.48k forks source link

fastimage is fetching images even if I enable cacheOnly #900

Open bimix opened 2 years ago

bimix commented 2 years ago

According to the documentation of the https://www.npmjs.com/package/react-native-fast-image if you do this:

cache={FastImage.cacheControl.cacheOnly} it should only show images from cache, not make any network requests.

However, I tried to clear cache and re run the app, it still fetches images:

  const cacheImg = profile_pic_url && (<TouchableOpacity ><FastImage
     source={{
        uri: profile_pic_url.url,
        priority: FastImage.priority.high,
     }}
     style={styles.userProfilePic}
     cache={FastImage.cacheControl.cacheOnly}
     resizeMode={FastImage.resizeMode.cover}
  /></TouchableOpacity>);

To be sure I even clear in the componentDidMount:


  FastImage.clearMemoryCache();
  FastImage.clearDiskCache();
putuoka commented 2 years ago

try to write that cacheonly inside source parameter like this


<FastImage
        source={{uri: imgSrc, cache: FastImage.cacheControl.cacheOnly}}
        resizeMode="cover"
        style={[s.pageCenter, s.page]}
        collapsable={false}></FastImage>
RiyaNainwani commented 1 year ago

Hey @putuoka, what is the purpose of using collapsable={false} ?