react-native-fetch-blob
react-native-fetch-blob copied to clipboard
RNFetchBlob blocked firebase/firestore call react native
I have a react native app that uses Firebase/firestore. For uploading images, I am using "react-native-fetch-blob (^0.10.8)" to create a Blob.
I am trying to fetch doc from firestore, but my app is blocked and not getting any response from firestore (not catch / nothing => just passing thru the code).
Is there anything I can do for getting docs from firestore?
Below is my code
import firebase from "../../../firebaseConfig"; import RNFetchBlob from "react-native-fetch-blob";
// Prepare Blob support window.XMLHttpRequest = RNFetchBlob.polyfill.XMLHttpRequest; const Blob = RNFetchBlob.polyfill.Blob; const fs = RNFetchBlob.fs; window.Blob = Blob; const originalXMLHttpRequest = window.XMLHttpRequest; const originalBlob = window.Blob;
var firebaseUid = "";
componentDidMount = async () => { firebaseUid = await firebase.auth().currentUser.uid; this.getMyStory(); };
getMyStory = async () => { window.XMLHttpRequest = originalXMLHttpRequest; window.Blob = originalBlob; var docRef = await firebase .firestore() .collection("demo") .doc(firebaseUid) .collection("ArrayDoc"); docRef .get() .then(querySnapshot => { querySnapshot.forEach(doc => { console.log(doc.id, " => ", doc.data()); }); }) .catch(error => { console.log("error", JSON.stringify(error)); }); };
Getting the same issue