简体   繁体   中英

[Unhandled promise rejection: TypeError: t._freezeSettings is not a function. (In 't._freezeSettings()', 't._freezeSettings' is undefined)]

i am using react native with firestore. As a result of these codes, I get the error in the title:

const email = firebase.auth().currentUser.email;
const dailyRef = firebase.firestore().collection('daily');

 setDoc(doc(dailyRef,email ), {
    name:"name",
    email:email });

const q = query(dailyRef, where("email", "==", email));

Had the same issue. Found out that, Instead of using the collection from firebase.firestore() directly, you will have to import the collection function from the firestore library itself and then pass your db like so:

import { collection } from "firebase/firestore"; // <---Use collection from this package
const email = firebase.auth().currentUser.email;
const db = firebase.firestore();
const dailyRef = collection(db, 'daily');

 setDoc(doc(dailyRef,email ), {
    name:"name",
    email:email });

const q = query(dailyRef, where("email", "==", email));

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM