blob: dfbbf70ecb70ec8a4098dda2b3df63f02c166e09 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
import RNFetchBlob from 'rn-fetch-blob';
export const loadImageFromURL = async (url: string) => {
try {
if (!url) {
return undefined;
}
const response = await RNFetchBlob.config({
fileCache: false,
appendExt: 'jpg',
}).fetch('GET', url);
const status = response.info().status;
if (status === 200) {
return response.path();
} else {
return undefined;
}
} catch (error) {
console.log(error);
return undefined;
}
};
|