diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/modules/fresco/ReactOkHttpNetworkFetcher.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/modules/fresco/ReactOkHttpNetworkFetcher.kt index c1b93c481ed948..2e0bec6a11948f 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/modules/fresco/ReactOkHttpNetworkFetcher.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/modules/fresco/ReactOkHttpNetworkFetcher.kt @@ -36,26 +36,26 @@ internal class ReactOkHttpNetworkFetcher(private val okHttpClient: OkHttpClient) fetchState.submitTime = SystemClock.elapsedRealtime() val uri = fetchState.uri var requestHeaders: Map? = null - val cacheControlBuilder = CacheControl.Builder().noStore() + val cacheControlBuilder = CacheControl.Builder() if (fetchState.context.imageRequest is ReactNetworkImageRequest) { val networkImageRequest = fetchState.context.imageRequest as ReactNetworkImageRequest requestHeaders = getHeaders(networkImageRequest.headers) when (networkImageRequest.cacheControl) { ImageCacheControl.RELOAD -> { - cacheControlBuilder.noCache() + cacheControlBuilder.noStore().noCache() } ImageCacheControl.FORCE_CACHE -> { - cacheControlBuilder - .onlyIfCached() - .maxStale(Integer.MAX_VALUE, TimeUnit.SECONDS) + cacheControlBuilder.maxStale(Integer.MAX_VALUE, TimeUnit.SECONDS) } ImageCacheControl.ONLY_IF_CACHED -> { - cacheControlBuilder.onlyIfCached() + cacheControlBuilder.onlyIfCached().maxStale(Integer.MAX_VALUE, TimeUnit.SECONDS) } ImageCacheControl.DEFAULT -> { - // No-op + cacheControlBuilder.noStore() } } + } else { + cacheControlBuilder.noStore() } val headers = OkHttpCompat.getHeadersFromMap(requestHeaders) val request =