I am working on a React-Native app where photos and documents are one of the main features needed. Users are constantly taking pictures on their device and we use the local uri to make a blob which is uploaded to AWS S3 with their aws-sdk.
The function we use to convert the local uri to a blob is below:
// https://github.com/expo/expo/issues/2402 - comment by "sjchmiela"
const convertUriToBlob = uri => {
return new Promise((resolve, reject) => {
const xhr = new XMLHttpRequest();
xhr.onerror = err => {
reject(err);
};
xhr.onreadystatechange = () => {
if (xhr.readyState === 4) {
resolve(xhr.response || xhr._response);
}
};
xhr.open('GET', uri);
xhr.responseType = 'blob'; // convert type
xhr.send();
});
};
When using this function on certain local uris we sometimes get an error that crashes the device:
I am looking for more information on this blob error or better alternatives to handling uploading a lot of photos/documents from a device.
The RN version is "react-native": "0.57.4"
Edit: Similar problem