Skip to content

Commit

Permalink
Merge pull request #36275 from ikevin127/fix/34881
Browse files Browse the repository at this point in the history
Android - Scan - Icons in Scan receipt context menu appear after delay
  • Loading branch information
MonilBhavsar authored Feb 14, 2024
2 parents 00fc955 + 0851d50 commit cc0e82d
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions src/components/ImageSVG/index.android.tsx
Original file line number Diff line number Diff line change
@@ -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 (
<Image
// Caching images to memory since some SVGs are being displayed with delay
// See issue: https://github.com/Expensify/App/issues/34881
cachePolicy="memory"
contentFit={contentFit}
source={src as ImageSourcePropType}
style={[{width, height}, style]}
// eslint-disable-next-line react/jsx-props-no-spreading
{...tintColorProp}
/>
);
}

ImageSVG.displayName = 'ImageSVG';
export default ImageSVG;
File renamed without changes.

0 comments on commit cc0e82d

Please sign in to comment.