react-native-fetch-blob icon indicating copy to clipboard operation
react-native-fetch-blob copied to clipboard

RNFetchBlob blocked firebase/firestore call react native

Open Gursewak-Uppal opened this issue 6 years ago • 1 comments

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)); }); };

screenshot 2019-01-09 at 9 29 01 am

Gursewak-Uppal avatar Jan 09 '19 03:01 Gursewak-Uppal

Getting the same issue

Ovi avatar Feb 19 '19 02:02 Ovi