Sdk31 - Blob Image to upload firebase


#1

Hey =)

Since I upgraded to Expo 31, the blob image are no longer working, the upload to firebase is empty.

I think it’s the same problem with this topics : Get Blob of Image? Breaking change SDK 31 or https://github.com/expo/firebase-storage-upload-example/issues/14

Do you have an idea ?

Thank you


#2

Ok I found a solution

use this custom function to convert to Blob:

_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();
        })
    }

#3

Yeah, this is a result of a problem in RN. Glad you found a workaround in the mean time!


closed #4

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.