I'm using XMLHttpRequest to upload images to my server in a post request and the images are in base64 format. I looked all over the web and found that i can add a "progress" event to the upload. but it only fires when upload is complete... how can I get upload progress for such request in react-native?
const http = new XMLHttpRequest();
http.upload.addEventListener("progress", function(e){}); // first attempt, not working...
http.addEventListener("progress", function(e){}); //second attempt, not working...
http.open("POST", url, true);
//Send the proper header information along with the request
http.setRequestHeader("Accept", "application/json, application/xml, text/plain, text/html, *.*");
http.setRequestHeader("Content-type", "application/x-www-form-urlencoded; charset=utf-8");
http.send(params);
The answers mentioned in How to get progress from XMLHttpRequest don't work. My guess is that react-native requires a different solution.