Skip to content

Commit 20153cb

Browse files
authored
fix crash blurhash expo image web (#985)
1 parent 6dd6638 commit 20153cb

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

packages/core/src/components/ExpoImage.tsx

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,16 @@ const ExpoImage: React.FC<ExtendedImageProps> = ({
5454
blurhash,
5555
...props
5656
}) => {
57-
const imageSource = source ?? Config.placeholderImageURL;
57+
let imageSource = source ?? Config.placeholderImageURL;
58+
// Prevent crash in Expo 50 when using expo-image with non-http/https URIs
59+
if (
60+
source &&
61+
typeof source === "object" &&
62+
"uri" in source &&
63+
!/^(http|https):\/\//.test(source.uri || "")
64+
) {
65+
imageSource = { uri: "" };
66+
}
5867
const finalContentFit = resizeMode
5968
? resizeModeToContentFit(resizeMode)
6069
: contentFit;

0 commit comments

Comments
 (0)