Skip to content

Commit

Permalink
update expo image
Browse files Browse the repository at this point in the history
  • Loading branch information
sieu-db committed Nov 29, 2024
1 parent bf1a9cf commit c7ebb15
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions packages/core/src/components/ExpoImage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,6 @@ type ImageStyleProp = {
};

interface ExtendedImageProps extends ExpoImageProps {
placeholder?: {
blurhash?: string;
thumbhash?: string;
};
transition?:
| number
| {
Expand All @@ -38,7 +34,8 @@ interface ExtendedImageProps extends ExpoImageProps {
contentPosition?: ImageContentPosition;
cachePolicy?: "none" | "disk" | "memory" | "memory-disk";
allowDownscaling?: boolean;
recyclingKey?: string;
blurRadius?: number;
blurhash?: string;
}

const generateDimensions = ({
Expand Down Expand Up @@ -93,13 +90,13 @@ const ExpoImage: React.FC<ExtendedImageProps> = ({
source,
resizeMode = "cover",
style,
placeholder,
transition = 300,
contentFit = "cover",
contentPosition = "center",
cachePolicy = "memory-disk",
allowDownscaling = true,
recyclingKey,
blurRadius,
blurhash,
...props
}) => {
let imageSource =
Expand All @@ -123,12 +120,14 @@ const ExpoImage: React.FC<ExtendedImageProps> = ({
{...props}
source={imageSource as ImageSourcePropType}
contentFit={finalContentFit}
placeholder={placeholder}
placeholder={{
blurhash,
}}
transition={transition}
contentPosition={contentPosition}
cachePolicy={cachePolicy}
allowDownscaling={allowDownscaling}
recyclingKey={recyclingKey}
blurRadius={blurRadius}
style={[
style,
{
Expand All @@ -146,12 +145,14 @@ const ExpoImage: React.FC<ExtendedImageProps> = ({
{...props}
source={source as ImageSourcePropType}
contentFit={finalContentFit}
placeholder={placeholder}
placeholder={{
blurhash,
}}
transition={transition}
contentPosition={contentPosition}
cachePolicy={cachePolicy}
allowDownscaling={allowDownscaling}
recyclingKey={recyclingKey}
blurRadius={blurRadius}
style={style}
/>
);
Expand Down

0 comments on commit c7ebb15

Please sign in to comment.