diff --git a/src/index.tsx b/src/index.tsx index d7baed9..7460d6e 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -102,10 +102,14 @@ export class ImageCache { cache.downloading = true; const method = source.method ? source.method : "GET"; cache.task = RNFetchBlob.config({ path }).fetch(method, uri, source.headers); - cache.task.then(() => { - cache.downloading = false; - cache.path = path; - this.notify(uri); + cache.task.then(res => { + if (res.info().status === 200) { + cache.downloading = false; + cache.path = path; + this.notify(uri); + } else { + cache.downloading = false; + } }).catch(() => { cache.downloading = false; // Parts of the image may have been downloaded already, (see https://github.com/wkh237/react-native-fetch-blob/issues/331)