Hi I am using:
"react": "16.0.0",
"react-native": "0.51.0",
"react-native-fetch-blob": "^0.10.8",
when i am using "window.XMLHttpRequest" i can upload my image to firebase bat canot write to firebas no more, whan i remove this i can write bat not upload the image.
my code is heare https://stackoverflow.com/questions/48215067/react-native-fetch-blob-is-blocking-firebase-calls-n-react-native-app
i dont know how to clear the window.XMLHttpRequest declaration on react native or reset it so the app can reach other calls.
please help
I am having the exact same problem as described above when using this package within React Native. The required code window.XMLHttpRequest = RNFetchBlob.polyfill.XMLHttpRequest; allows me to successfully upload to Firebase Storage, but any subsequent calls, in my case, to Firebase Cloud Firestore (database) are blocked completely. When I comment _out_ this line of code, uploading to Cloud Firestore database DOES work, but Firebase Storage no longer does. Do you have any recommendations, solutions with this? Like Amos says, to maybe reset the window back to default window_after_ my Firebase Storage upload? Thank you.
_NOTE_: upon further testing: this error only arises for me in the Cloud Firestore database (beta), it does not arise in the Firebase Realtime Database. It is working there.
I am uploading to my node js app and from there connecting to firebase for uploading and saving the images in any size/blob....working 100%
I'm having the exact same problem-- did anyone figure out how to resolve this?
@terranball if this helps at all, what I did was the following (again, my issue was making a call specifically from my React Native app to Firebase _Cloud Firestore_):
As you see, it's a little hacky, but is currently working well for me. I set the window.XMLHttpRequest to a temp variable, then do my thing with react-native-fetch-blob, then later on, right before I am about to make my call to Cloud Firestore, I reset window.XMLHttpRequest to the original temp variable.
const Blob = RNFetchBlob.polyfill.Blob;
window.Blob = Blob;
const tempWindowXMLHttpRequest = window.XMLHttpRequest;
window.XMLHttpRequest = RNFetchBlob.polyfill.XMLHttpRequest;
...
window.XMLHttpRequest = tempWindowXMLHttpRequest;
Could this be re-opened? It is causing problems with Firebase's SDK for Google Cloud Firestore as well. It would be really nice if the polyfill could be fixed to be fully compatible or else better scope its usage so that it doesn't affect other libraries.
Hi, I'm new to react-native. Im also getting the same issue when I wanna upload an image to firebase. Can I know where is the "window" variable is declared? and what is it?
Most helpful comment
@terranball if this helps at all, what I did was the following (again, my issue was making a call specifically from my React Native app to Firebase _Cloud Firestore_):
As you see, it's a little hacky, but is currently working well for me. I set the
window.XMLHttpRequestto a temp variable, then do my thing withreact-native-fetch-blob, then later on, right before I am about to make my call to Cloud Firestore, I resetwindow.XMLHttpRequestto the original temp variable.