I am trying to upgrade to RNFirebase 6 from 5 and am going to move all my authentications from firebase.js sdk to RNFirebase and I am not sure why this initialization isn't working. I am using service everywhere so no idea what to be doing differently.
import { firebaseConfig } from '../configs/firebase';
import firebase from '@react-native-firebase/app';
import '@react-native-firebase/auth';
import "@react-native-firebase/database"
import "@react-native-firebase/dynamic-links"
import "@react-native-firebase/firestore"
import "@react-native-firebase/functions"
import "@react-native-firebase/iid"
import "@react-native-firebase/in-app-messaging"
import "@react-native-firebase/messaging"
import "@react-native-firebase/remote-config"
import "@react-native-firebase/storage"
import "@react-native-firebase/database"
import "@react-native-firebase/dynamic-links"
import "@react-native-firebase/firestore"
import "@react-native-firebase/functions"
let instance = null;
class FirebaseService {
constructor() {
if (!instance) {
this.app = firebase.initializeApp(firebaseConfig)
firebase.database().setLoggingEnabled(true);
instance = this;
}
return instance;
}
}
const firebaseService = new FirebaseService().app;
export default firebaseService;
So I didn't realize with React-Native-Firebase none of this initialization is needed. I am not sure why the
initializeApp
is in the docs or used anywhere. Hopefully this helps someone else out in the future since I banged my head against the wall all day