admin管理员组文章数量:1290978
I am trying to set up Firebase in a React Native project using the Firebase Modular SDK (version 9+). However, I am encountering the following error:
Property 'apps' does not exist on type '(options: FirebaseAppOptions, name?: string | undefined) => FirebaseApp'.
I installed all the NPM packeges, made a .env file and changed the babel.config.js
Initialized Firebase in a utility file (firebase.ts
import { initializeApp, getApps, getApp } from 'firebase/app';
import { getAuth } from 'firebase/auth';
import { getFirestore } from 'firebase/firestore';
import { API_KEY, AUTH_DOMAIN, PROJECT_ID, STORAGE_BUCKET, MESSAGING_SENDER_ID, APP_ID } from '@env';
const firebaseConfig = {
apiKey: API_KEY,
authDomain: AUTH_DOMAIN,
projectId: PROJECT_ID,
storageBucket: STORAGE_BUCKET,
messagingSenderId: MESSAGING_SENDER_ID,
appId: APP_ID,
};
const app = !getApps().length ? initializeApp(firebaseConfig) : getApp();
export const firebaseAuth = getAuth(app);
export const firebaseFirestore = getFirestore(app);
Tried everything i could but i have no clue anymore.
版权声明:本文标题:javascript - Issues with Firebase Initialization and Environment Variables in React Native - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741523017a2383301.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论