2

// imports of screens and react standards dependency

import { createAppContainer, createSwitchNavigator } from "react-navigation"
import { createStackNavigator } from "@react-navigation/stack"
import LoadingScreen from "./screens/LoadingScreen"
import LoginScreen from "./screens/LoginScreen"
import RegisterScreen from "./screens/RegisterScreen"
import HomeScreen from "./screens/HomeScreen"

//firebase import

import * as firebase from 'firebase/app';

import 'firebase/auth';
import 'firebase/firestore';
import 'firebase/storage';
import 'firebase/messaging';
import 'firebase/analytics';

//firebase config

const firebaseConfig = {
  apiKey: "privateforquestion",
  authDomain: "privateforquestion",
  projectId: "privateforquestion",
  storageBucket: "privateforquestion",
  messagingSenderId: "privateforquestion",
  appId: "privateforquestion"
};

// Initialize Firebase

firebase.initializeApp(firebaseConfig);

//creating navigations and auth

const AppStack = createStackNavigator({
  Home: HomeScreen,
});

const AuthStack = createStackNavigator({
  Login: LoginScreen,
  Register: RegisterScreen,
});

export default createAppContainer(
  createSwitchNavigator(
    {
      Loading: LoadingScreen,
      App: AppStack,
      Auth: AuthStack,
    },
    {
      initialRouteName: "Loading",
    }
  )
);

1 Answers1

1

Try downgrading your firebase to 9.2.0.

I had the same issue using expo 46.0.9 and react-native 0.69.5, I have downgraded firebase to 9.2.0, which works for the time being.

npm install firebase@9.2.0

Update

Create a file named metro.config.js on the root of the project.

and add the below code in the file.

const { getDefaultConfig } = require('expo/metro-config');
const defaultConfig = getDefaultConfig(__dirname);
defaultConfig.resolver.sourceExts.push('cjs');
module.exports = defaultConfig;

This should work with the latest version on firebase > 9.10.0