From c36860d30c8c38b36ea42c390fa229c5b7de1626 Mon Sep 17 00:00:00 2001 From: Sohrab Quraishi Date: Fri, 9 Jan 2026 16:13:37 +0430 Subject: [PATCH] DEV-79191: implemented caching images for offline visibility --- src/components/Image/BaseImage.ios.tsx | 8 ++++++-- src/components/Image/index.tsx | 3 +++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/components/Image/BaseImage.ios.tsx b/src/components/Image/BaseImage.ios.tsx index 5fd7bfa5a9b13..409245db42816 100644 --- a/src/components/Image/BaseImage.ios.tsx +++ b/src/components/Image/BaseImage.ios.tsx @@ -36,6 +36,11 @@ function BaseImage({onLoad, source, ...props}: BaseImageProps) { [onLoad, setAttachmentLoaded, source], ); + // Use disk caching for images that need to work offline (e.g., receipts with auth tokens) + // Use no caching for other images to avoid memory leaks + // Check if cachePolicy is explicitly provided in props, otherwise default based on whether it's an auth-required image + const effectiveCachePolicy = props.cachePolicy ?? 'none'; + return ( ); } diff --git a/src/components/Image/index.tsx b/src/components/Image/index.tsx index bb0b10857d6eb..81cae0e4fa0cc 100644 --- a/src/components/Image/index.tsx +++ b/src/components/Image/index.tsx @@ -171,6 +171,9 @@ function Image({ onLoad={handleLoad} style={[style, aspectRatioStyle, shouldOpacityBeZero && {opacity: 0}]} source={source} + // Enable disk caching for images that require auth tokens (receipts) to make them available offline + // Keep default (none) for other images to avoid memory leaks + cachePolicy={isAuthTokenRequired ? 'disk' : forwardedProps.cachePolicy} /> ); }