const takePicture = async () => {
if (cameraRef.current) {
const options = { quality: 0.5, base64: true, skipProcessing: true };
const result = await cameraRef.current.takePictureAsync(options);
let ImageStuff = result.uri
let SavedPic = await uploadImageAsync(result.uri);
console.log(ImageStuff);
}
};
async function uploadImageAsync(projectSavePic) {
const blob = await new Promise((resolve, reject) => {
const xhr = new XMLHttpRequest();
xhr.onload = function () {
resolve(xhr.response);
};
xhr.onerror = function (e) {
console.log(e);
reject(new TypeError('Network request failed'));
};
xhr.responseType = 'blob';
xhr.open('GET', projectSavePic, true);
xhr.send(null);
});