I have a firebase file where I've storing all my config data
import { initializeApp } from 'firebase/app';
import { getAuth } from 'firebase/auth';
add firebase config
const firebaseConfig = {
apiKey: "",
authDomain: "",
projectId: "",
storageBucket: "",
messagingSenderId: "",
appId: "",
measurementId: ""
};
initialize firebase
initializeApp(firebaseConfig);
initialize auth
const auth = getAuth();
export { auth };
I have a home page calling the config file but I keep getting the same error I've made sure to check if I'm importing it properly
import auth from '../config'
import 'firebase/compat/firestore';
import firebase from 'firebase/compat/app';
export const HomeScreen = () => {
if(!firebase.apps.length){
firebase.initializeApp(auth);
}
Call Stack
This error is located at: in HomeScreen (created by SceneView) in StaticContainer in EnsureSingleNavigator (created by SceneView) in SceneView (created by BottomTabView) in RCTView (created by View) in View (created by Screen) in RCTView (created by View) in View (created by Background) in Background (created by Screen) in Screen (created by BottomTabView) in RNSScreen (created by AnimatedComponent) in AnimatedComponent in AnimatedComponentWrapper (created by Screen) in Screen (created by MaybeScreen) in MaybeScreen (created by BottomTabView) in RNSScreenContainer (created by ScreenContainer) in ScreenContainer (created by MaybeScreenContainer) in MaybeScreenContainer (created by BottomTabView) in RCTView (created by View) in View (created by SafeAreaInsetsContext) in SafeAreaProviderCompat (created by BottomTabView) in BottomTabView (created by BottomTabNavigator) in Unknown (created by BottomTabNavigator) in BottomTabNavigator (created by MainStackScreens) in MainStackScreens (created by SceneView) in StaticContainer in EnsureSingleNavigator (created by SceneView) in SceneView (created by CardContainer) in RCTView (created by View) in View (created by CardContainer) in RCTView (created by View) in View (created by CardContainer) in RCTView (created by View) in View in CardSheet (created by Card) in RCTView (created by View) in View (created by AnimatedComponent) in AnimatedComponent in AnimatedComponentWrapper (created by PanGestureHandler) in PanGestureHandler (created by PanGestureHandler) in PanGestureHandler (created by Card) in RCTView (created by View) in View (created by AnimatedComponent) in AnimatedComponent in AnimatedComponentWrapper (created by Card) in RCTView (created by View) in View (created by Card) in Card (created by CardContainer) in CardContainer (created by CardStack) in RNSScreen (created by AnimatedComponent) in AnimatedComponent in AnimatedComponentWrapper (created by Screen) in Screen (created by MaybeScreen) in MaybeScreen (created by CardStack) in RNSScreenContainer (created by ScreenContainer) in ScreenContainer (created by MaybeScreenContainer) in MaybeScreenContainer (created by CardStack) in RCTView (created by View) in View (created by Background) in Background (created by CardStack) in CardStack (created by HeaderShownContext) in RCTView (created by View) in View (created by SafeAreaInsetsContext) in SafeAreaProviderCompat (created by StackView) in GestureHandlerRootView in GestureHandlerRootView (created by StackView) in StackView (created by StackNavigator) in Unknown (created by StackNavigator) in StackNavigator (created by AppStack) in AppStack (created by RootNavigator) in EnsureSingleNavigator in BaseNavigationContainer in ThemeProvider in NavigationContainerInner (created by RootNavigator) in RootNavigator (created by App) in RNCSafeAreaProvider (created by SafeAreaProvider) in SafeAreaProvider (created by App) in AuthenticatedUserProvider (created by App) in App (created by ExpoRoot) in ExpoRoot in RCTView (created by View) in View (created by AppContainer) in RCTView (created by View) in View (created by AppContainer) in AppContainer at node_modules\react-native\Libraries\LogBox\LogBox.js:149:8 in registerError at node_modules\react-native\Libraries\LogBox\LogBox.js:60:8 in errorImpl at node_modules\react-native\Libraries\LogBox\LogBox.js:34:4 in console.error at node_modules\expo\build\environment\react-native-logs.fx.js:27:4 in error at node_modules\react-native\Libraries\Core\ExceptionsManager.js:104:6 in reportException at node_modules\react-native\Libraries\Core\ExceptionsManager.js:172:19 in handleException at node_modules\react-native\Libraries\Core\ReactFiberErrorDialog.js:43:2 in showErrorDialog at node_modules\react-native\Libraries\Renderer\implementations\ReactNativeRenderer-dev.js:15792:34 in logCapturedError at node_modules\react-native\Libraries\Renderer\implementations\ReactNativeRenderer-dev.js:15884:20 in update.callback at node_modules\react-native\Libraries\Renderer\implementations\ReactNativeRenderer-dev.js:7199:2 in callCallback at node_modules\react-native\Libraries\Renderer\implementations\ReactNativeRenderer-dev.js:7220:20 in commitUpdateQueue at node_modules\react-native\Libraries\Renderer\implementations\ReactNativeRenderer-dev.js:16632:25 in commitLifeCycles at node_modules\react-native\Libraries\Renderer\implementations\ReactNativeRenderer-dev.js:19216:22 in commitLayoutEffects at node_modules\react-native\Libraries\Renderer\implementations\ReactNativeRenderer-dev.js:93:4 in invokeGuardedCallbackProd at node_modules\react-native\Libraries\Renderer\implementations\ReactNativeRenderer-dev.js:318:2 in invokeGuardedCallback at node_modules\react-native\Libraries\Renderer\implementations\ReactNativeRenderer-dev.js:18952:29 in commitRootImpl at node_modules\scheduler\cjs\scheduler.development.js:468:23 in unstable_runWithPriority at node_modules\react-native\Libraries\Renderer\implementations\ReactNativeRenderer-dev.js:18791:17 in commitRoot at node_modules\react-native\Libraries\Renderer\implementations\ReactNativeRenderer-dev.js:18192:12 in performSyncWorkOnRoot at node_modules\react-native\Libraries\Renderer\implementations\ReactNativeRenderer-dev.js:5911:33 in runWithPriority$argument_1 at node_modules\scheduler\cjs\scheduler.development.js:468:23 in unstable_runWithPriority at node_modules\react-native\Libraries\Renderer\implementations\ReactNativeRenderer-dev.js:5906:23 in flushSyncCallbackQueueImpl at node_modules\react-native\Libraries\Renderer\implementations\ReactNativeRenderer-dev.js:5893:28 in flushSyncCallbackQueue at node_modules\react-native\Libraries\Renderer\implementations\ReactNativeRenderer-dev.js:17745:30 in scheduleUpdateOnFiber at node_modules\react-native\Libraries\Renderer\implementations\ReactNativeRenderer-dev.js:11332:25 in dispatchAction at navigation\RootNavigator.js:23:20 in onAuthStateChanged$argument_1 at node_modules\react-native\node_modules\promise\setimmediate\core.js:37:13 in tryCallOne at node_modules\react-native\node_modules\promise\setimmediate\core.js:123:24 in setImmediate$argument_0 at node_modules\react-native\Libraries\Core\Timers\JSTimers.js:123:14 in _callTimer at node_modules\react-native\Libraries\Core\Timers\JSTimers.js:177:14 in _callImmediatesPass at node_modules\react-native\Libraries\Core\Timers\JSTimers.js:437:30 in callImmediates at node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:388:6 in __callImmediates at node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:132:6 in __guard$argument_0 at node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:365:10 in __guard at node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:131:4 in flushedQueue
CodePudding user response:
export const auth = getAuth();
import {auth} from '../config'
CodePudding user response:
if you export it like you mentioned:
const auth = getAuth();
export { auth };
you should import it be like:
import {auth} from "../config"