1
votes

Does React Native only provides image caching support on iOS.

https://facebook.github.io/react-native/docs/images.html#cache-control-ios-only

<Image
    source={{
        uri: 'some url',
        cache: 'only-if-cached',
    }}
    style={{width: 200, height: 200}}
/>

I checked above code with Android 7 device and its working.

Looking for advice/confirmation on whether this works n both iOS and Android.

Is it is a permanent disk cache?

Thank You

1

1 Answers

1
votes

Cache Control is supported only for iOS at the moment and Android usage is not mentioned in the documents so I wouldn't recommend using it. I recommend using react-native-cached-image which is, in my opinion, a better alternative.

Here's an example of its usage:

import { CachedImage } from 'react-native-cached-image';

<CachedImage 
   style={{
     width: 200,
     height: 200
   }}
   source={{ uri: 'some url' }}
/>