-1

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;
Stephen Phillips
  • 641
  • 10
  • 26
  • If I comment out this line or place in a .then block- ```firebase.database().setLoggingEnabled(true);``` then I get ```firebase.default.database is not a function``` – Stephen Phillips Oct 10 '20 at 20:17

1 Answers1

0

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

Stephen Phillips
  • 641
  • 10
  • 26