Skip to content

Commit 8324905

Browse files
committed
[fix] ImageLoader images are not added to ImageUriCache
Previously loaded images used to be added to ImageUriCache It seems the logic was accidentally removed here: f4e8b6b#diff-7cb74a3a32d73857be80350ecd1ea131d256bd5af11d2000e4fc2d03c2230584L361 And now the `ImageUriCache` is only updated by preload/getSize
1 parent c88663b commit 8324905

File tree

1 file changed

+5
-2
lines changed
  • packages/react-native-web/src/modules/ImageLoader

1 file changed

+5
-2
lines changed

packages/react-native-web/src/modules/ImageLoader/index.js

+5-2
Original file line numberDiff line numberDiff line change
@@ -81,12 +81,13 @@ const ImageLoader = {
8181
release(requestId: number) {
8282
const request = requests[requestId];
8383
if (request) {
84-
const { image, cleanup } = request;
84+
const { image, cleanup, source } = request;
8585
if (cleanup) cleanup();
8686

8787
image.onerror = null;
8888
image.onload = null;
8989
image.src = '';
90+
ImageUriCache.remove(source.uri);
9091
delete requests[requestId];
9192
}
9293
},
@@ -135,14 +136,16 @@ const ImageLoader = {
135136

136137
const handleLoad = () => {
137138
// avoid blocking the main thread
138-
const onDecode = () =>
139+
const onDecode = () => {
140+
ImageUriCache.add(source.uri);
139141
onLoad({
140142
source: {
141143
uri: image.src,
142144
width: image.naturalWidth,
143145
height: image.naturalHeight
144146
}
145147
});
148+
};
146149

147150
// Safari currently throws exceptions when decoding svgs.
148151
// We want to catch that error and allow the load handler

0 commit comments

Comments
 (0)