From 4c35dab581122b36aab58ab69000becfedf9c4d0 Mon Sep 17 00:00:00 2001 From: Kevin Brian Bader Date: Fri, 9 Feb 2024 19:09:38 +0200 Subject: [PATCH] Android - Scan - Icons in Scan receipt context menu appear after delay --- src/components/ImageSVG/index.android.tsx | 32 +++++++++++++++++++ .../{index.native.tsx => index.ios.tsx} | 0 2 files changed, 32 insertions(+) create mode 100644 src/components/ImageSVG/index.android.tsx rename src/components/ImageSVG/{index.native.tsx => index.ios.tsx} (100%) diff --git a/src/components/ImageSVG/index.android.tsx b/src/components/ImageSVG/index.android.tsx new file mode 100644 index 000000000000..9c8ae8f8801a --- /dev/null +++ b/src/components/ImageSVG/index.android.tsx @@ -0,0 +1,32 @@ +import {Image} from 'expo-image'; +import React, {useEffect} from 'react'; +import type {ImageSourcePropType} from 'react-native'; +import type ImageSVGProps from './types'; + +function ImageSVG({src, width = '100%', height = '100%', fill, contentFit = 'cover', style}: ImageSVGProps) { + const tintColorProp = fill ? {tintColor: fill} : {}; + + // Clear memory cache when unmounting images to avoid memory overload + useEffect(() => { + const clearMemoryCache = () => Image.clearMemoryCache(); + return () => { + clearMemoryCache(); + }; + }, []); + + return ( + + ); +} + +ImageSVG.displayName = 'ImageSVG'; +export default ImageSVG; diff --git a/src/components/ImageSVG/index.native.tsx b/src/components/ImageSVG/index.ios.tsx similarity index 100% rename from src/components/ImageSVG/index.native.tsx rename to src/components/ImageSVG/index.ios.tsx