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

RNFetchBlob blocked firebase/firestore call react native #737

Open
@Gursewak-Uppal

Description

@Gursewak-Uppal

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions