Skip to content
This repository has been archived by the owner on Mar 16, 2019. It is now read-only.

RNFetchBlob blocked firebase/firestore call react native #737

Open
Gursewak-Uppal opened this issue Jan 9, 2019 · 1 comment
Open

RNFetchBlob blocked firebase/firestore call react native #737

Gursewak-Uppal opened this issue Jan 9, 2019 · 1 comment

Comments

@Gursewak-Uppal
Copy link

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

@Ovi
Copy link

Ovi commented Feb 19, 2019

Getting the same issue

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants