firebase-storage-upload-example
firebase-storage-upload-example copied to clipboard
Response.blob() is not working
When I implemented this code, I got this mistake:
[TypeError: response.blob is not a function. (In 'response.blob()', 'response.blob' is undefined)]
When I debug it, if I print response, it prints response object after mistake. I'm sure that await/async is in the code.
Any get this error ?
I did but I solved it by updating expo to SDK28 and updating react-native to 0.55.4 (which expo SDK28 is based on).
@maxweb4u Hi, I am facing the same issue with expo 31.0.2
. Did you managed to solve it somehow?
@anees715 yes, I have fixed it, it's working with 25.0.0
@anees715 I am also facing the same issue. It was working with expo 27.0.0. After upgrading to 31.0.2 it stopped working. When I upload an image to firebase storage it is uploading a blank image because of this blob issue. @maxweb4u How do you downgrade your expo? When I create a new expo project it automatically uses the latest version.
@anees715 Hey I have found the solution. Here is a function to get the blob from an uri: 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(); }) }
After calling this function you'll get the blob and everything should be fine now ;)