Skip to content

Commit a46e085

Browse files
committed
[ImageLoader] Simplify getSize implementation
Fixes possible infinite intervals
1 parent b428f0f commit a46e085

File tree

1 file changed

+0
-10
lines changed
  • packages/react-native-web/src/modules/ImageLoader

1 file changed

+0
-10
lines changed

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

-10
Original file line numberDiff line numberDiff line change
@@ -88,31 +88,21 @@ const ImageLoader = {
8888
success: (width: number, height: number) => void,
8989
failure: () => void
9090
) {
91-
let complete = false;
92-
const interval = setInterval(callback, 16);
9391
const requestId = ImageLoader.load(uri, callback, errorCallback);
94-
9592
function callback() {
9693
const image = requests[`${requestId}`];
9794
if (image) {
9895
const { naturalHeight, naturalWidth } = image;
9996
if (naturalHeight && naturalWidth) {
10097
success(naturalWidth, naturalHeight);
101-
complete = true;
10298
}
10399
}
104-
if (complete) {
105-
ImageLoader.abort(requestId);
106-
clearInterval(interval);
107-
}
108100
}
109-
110101
function errorCallback() {
111102
if (typeof failure === 'function') {
112103
failure();
113104
}
114105
ImageLoader.abort(requestId);
115-
clearInterval(interval);
116106
}
117107
},
118108
has(uri: string): boolean {

0 commit comments

Comments
 (0)