[Default]: Firebase: No Firebase App '[Default]' has been created - call Firebase App.initializaApp() (app/no-app)


#1

Hello @Expo team

I am integrating firebase to my react-native project but while integrating it shows the following error

Here is the App.js code

import React, { Component } from 'react';
import { StyleSheet, Text, View } from 'react-native';
import {createStackNavigator, createSwitchNavigator } from 'react-navigation';
import Home from './components/Home';
import Login from './components/Login';

import AuthLoading from './components/AuthLoading';
import PedometerSensor from './components/PedometerSensor';
import ViewStepCount from './components/ViewStepCount';
import Splash from './components/Splash';

const firebase = require("firebase");
// Required for side-effects
require("firebase/firestore");

const AppStack = createStackNavigator({ Home: Home, PedometerSensor: PedometerSensor, ViewStepCount: ViewStepCount });
const AuthStack = createStackNavigator({ Login: Login });

class App extends Component{
 componentWillMount() {
    const config = {
      apiKey: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
      authDomain: "firestorecrud-b08be.firebaseapp.com",
      databaseURL: "https://firestorecrud-b08be.firebaseio.com",
      projectId: "firestorecrud-b08be",
      storageBucket: "firestorecrud-b08be.appspot.com",
      messagingSenderId: "742054197796"
 };
 firebase.initializeApp(firebaseconfig);
  }
}

export default createSwitchNavigator(
  {
    AuthLoading: AuthLoading,
    App: AppStack,
    Auth: AuthStack,
  },
  {
    initialRouteName: 'AuthLoading',
  }
);

Can anyone please help me out what is the issue while configuring firebase?

Thank you in advance


#2

Hi! This seems like it’s probably an issue with your firebase configuration either in your code or on the server.


closed #3

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.