MichaelSolati/geofirestore-js

firebase geofirestore v9 not working

andresfmm opened this issue · 1 comments

hi michael hou are you?

this code not working firebase is working but geofirestore return TypeError: undefined is not a function

firebase web sdk with react native

import { initializeApp } from "firebase/app";
import { 
    getFirestore, 
    initializeFirestore,
    collection, 
    addDoc, 
    getDocs } from "@firebase/firestore";

import { getAuth, signInWithEmailAndPassword } from "firebase/auth";    



const firebaseConfig = {
    apiKey: "xxx",
    authDomain: "xxx",
    databaseURL: "xxx",
    projectId: "xxx",
    storageBucket: "xxx",
    messagingSenderId: "xxx",
    appId: "xxx",
    measurementId: "xxx"
};


const app = initializeApp(firebaseConfig);

  



const db = initializeFirestore(app, {
    experimentalForceLongPolling: true
})



const GeoFirestore = geofirestore.initializeApp(db);



export {
    db,
    getDocs,
    collection,
    getAuth,
    signInWithEmailAndPassword,
    GeoFirestore
}

error here the error is undefine the code break here stop here

const geocollection = await GeoFirestore.collection('users').where("status", "==", status)



const geoQuery = geocollection.near({
    center: new db.GeoPoint(latitude, longitude),
    radius: 10,
});
 

// Get query (as Promise)
const idcollection = await geoQuery.get();

i hope some one can help me

thanks a lot

Support for the modular firestore library doesn't exist yet, see here, for now you need to use the compat library.

Modular support is being worked on, see here.

I'm closing this issue in favor of #219