Skip to content

Commit

Permalink
Image - resolveBlobUri should be used on the hidden image
Browse files Browse the repository at this point in the history
`resolveBlobUri` causes difficulties for the logic that identifies
resolved source changes
It is not necessary to be applied there, but only on the hidden image
  • Loading branch information
kidroca committed Nov 25, 2022
1 parent f0e6cc8 commit a356985
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions packages/react-native-web/src/exports/Image/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,6 @@ function resolveSource(source: ?Source): ImageSource {
const match = resolvedSource.uri.match(svgDataUriPattern);
if (match) {
resolvedSource = resolveSvgDataUriSource(resolvedSource, match);
} else {
resolvedSource = resolveBlobUri(resolvedSource);
}
}

Expand Down Expand Up @@ -181,11 +179,8 @@ function resolveSvgDataUriSource(
}

// resolve any URI that might have a local blob URL create by `createObjectURL`
function resolveBlobUri(source: ImageSource): ImageSource {
return {
...source,
uri: ImageLoader.resolveBlobUri(source.uri) || source.uri
};
function resolveBlobUri(source: ImageSource): string {
return ImageLoader.resolveBlobUri(source.uri);
}

function getSourceToDisplay(main, fallback) {
Expand Down Expand Up @@ -245,7 +240,7 @@ const Image: React.AbstractComponent<
const fallbackSource = useSource(imageLoadingProps, defaultSource);
const mainSource = useSource(imageLoadingProps, source);
const availableSource = getSourceToDisplay(mainSource, fallbackSource);
const displayImageUri = availableSource.uri;
const displayImageUri = resolveBlobUri(availableSource);
const imageSizeStyle = resolveAssetDimensions(availableSource);

const [layout, updateLayout] = React.useState({});
Expand Down

0 comments on commit a356985

Please sign in to comment.