firebase-storage-upload-example
firebase-storage-upload-example copied to clipboard
image fetching fails in SDK 31 Android 5 and 7
Hi there, I was trying this example using Expo SDK 31 and Android 5 and 7 (because SDK 31 only works with 5+) But there is an issue here: const response = await fetch(uri);
It will say: [TypeError: Network request failed]
It was working when I was using SDK 27 and Android 4 Now that I upgraded Expo I came across this issue..
Have same issue here, anyone find a fix?
@edvin1983 I already have a fix. You can use this function to get the blob: function urlToBlob(url) { return new Promise((resolve, reject) => { var xhr = new XMLHttpRequest(); xhr.onerror = reject; xhr.onreadystatechange = () => { if (xhr.readyState === 4) { resolve(xhr.response); } }; xhr.open('GET', url); xhr.responseType = 'blob'; // convert type xhr.send(); }) }
;)
@jlsilva10 it's worked for me, ty, u saved my life!
Yes, THANKYOU!
I was using Expo sdk 32 and there is literally nothing about getting an image to firebase storage in expo. It seemed impossible. However, your xhr example and the fantastic explanation around it in the github comment has solved everything. Well done.