import firebase from 'firebase/compat/app';
import '@react-native-firebase/database';
import 'firebase/compat/auth';
import 'firebase/compat/firestore';

const firebaseConfig = {
    apiKey: 'AIzaSyCxKc9YpoVlch4VXGKHlmEaIJaD6RypG7c',
    authDomain: 'white-rose-1c834.firebaseapp.com',
    databaseURL: 'https://white-rose-1c834-default-rtdb.firebaseio.com/',
    projectId: 'white-rose-1c834',
    storageBucket: "white-rose-1c834.appspot.com",
    messagingSenderId: '443024309358',
    appId: '1:443024309358:android:7f8f6200cf7f9d609e3a7f',
  };

  const firebaseApp = firebase.initializeApp(firebaseConfig);
  
  if (!firebase.apps.length) {
    firebase.initializeApp(firebaseConfig);
  }

  const db = firebaseApp.firestore();
  const auth = firebase.auth();
  export { auth, db };


 ERROR  TypeError: Cannot read property 'initializeApp' of undefined, js engine: hermes
 ERROR  Invariant Violation: "main" has not been registered. This can happen if:
* Metro (the local dev server) is run from the wrong folder. Check if Metro is running, stop it and restart it in the current project.
* A module failed to load due to an error and `AppRegistry.registerComponent` wasn't called., js engine: hermes