React Native firebase.firestore' is undefined

Viewed 15

i'm trying to create an app and i'm using to firebase authentication with firestore. whatever when i want to use firestore this error occuring.

here my firebase configuration

import firebase from "firebase/compat/app"
import 'firebase/firestore';
import { getFirestore } from "firebase/firestore"
import {
    initializeAuth,
} from 'firebase/auth/react-native';

import { apiKeyUrl, apiIdUrl } from './env'

const apiKey = apiKeyUrl.apiKey
const apiId = apiIdUrl.apiId

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

// Initialize Firebase and Firestore

const app = firebase.initializeApp(firebaseConfig)
const auth = initializeAuth(app);

export { firebase, auth }

and

firebase
    .firestore()
    .collection('users')
    .add({
         userEmail : "asda",
         userId : "asddd",
         userName : "aaa1",

here the error

err : TypeError: _$$_REQUIRE(_dependencyMap[8], "../../../config").firebase.firestore is not a function. (In '_$$_REQUIRE(_dependencyMap[8], "../../../config").firebase.firestore()', '_$$_REQUIRE(_dependencyMap[8], "../../../config").firebase.firestore' is undefined)

firebase version is "firebase": "^9.6.11", i think my imports or initializing have a problem.

0 Answers
Related