EddyVerbruggen / nativescript-plugin-firebase

:fire: NativeScript plugin for Firebase
https://firebase.google.com
MIT License
1.01k stars 448 forks source link

_firebase_common__WEBPACK_IMPORTED_MODULE_1__.firebase.firestore.WriteBatch is not a constructor #1807

Open ChadStrat opened 3 years ago

ChadStrat commented 3 years ago
"@nativescript/core": "8.0.1",
"@nativescript/firebase": "^11.1.3",

I get the following error on iOS only (not android) when I attempt to set up a batch.

_firebase_common__WEBPACK_IMPORTED_MODULE_1__.firebase.firestore.WriteBatch is not a constructor

code causing error:

import * as firebase from "@nativescript/firebase";

functionName {
   let batch = firebase.firestore.batch();
}

I feel like I am missing something really obvious. Any help appreciated.

A-Justice commented 3 years ago

I have the exact same problem .. any help please

A-Justice commented 3 years ago

I went over to node_module/@nativescript/firebase/firebase.ios.js. changed firebase.firestore.batch = () => { ensureFirestore(); return new firebase.firestore.WriteBatch(FIRFirestore.firestore().batch()); }; to firebase.firestore.batch = () => { ensureFirestore(); return firebase.firestore.WriteBatch(FIRFirestore.firestore().batch()); };

Solved my problem

ChadStrat commented 3 years ago

ahhhh yes. just what I was looking for. do we know if someone is working on a PR to fix this?

ChadStrat commented 3 years ago

node_module/@nativescript/firebase/firebase.ios.js.

firebase.firestore.batch = () => { ensureFirestore(); return new firebase.firestore.WriteBatch(FIRFirestore.firestore().batch()); };

should be

firebase.firestore.batch = () => { ensureFirestore(); return firebase.firestore.WriteBatch(FIRFirestore.firestore().batch()); };