Sdk31 - Blob Image to upload firebase

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

Ok I found a solution

use this custom function to convert to Blob:

https://github.com/expo/firebase-storage-upload-example/issues/13

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

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

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