Home > Software design >  How can I install Firebase in Expo React native?
How can I install Firebase in Expo React native?

Time:11-22

I'm trying to install Firebase in Expo.

On the Expo document, they recommend using this library react-native-firebase.

What do I need to do after running this command?

npm install --save @react-native-firebase/app

CodePudding user response:

First of all, if you are working with an expo you should be using the below command to install Firebase for your expo

expo install firebase

After that, you need to visit your Firebase Console and get the API key and other identifiers from there into a new file and store that information such as

const firebaseConfig = {
   apiKey: 'api-key',
   authDomain: 'project-id.firebaseapp.com',
   databaseURL: 'https://project-id.firebaseio.com',
   projectId: 'project-id',
   storageBucket: 'project-id.appspot.com',
   messagingSenderId: 'sender-id',
   appId: 'app-id',
   measurementId: 'G-measurement-id',
};

After this, you are good to go and start working with Firebase

You can refer to Expo Firebase Documentation for a more detailed understanding.

Feel free to ask anything more

CodePudding user response:

Install firebase in expo-project via expo install firebase instead of npm.

If you want to use firestore use the JS sdk, and get the firestore like this:

const db = initializeFirestore(app,{useFetchStreams :false}as any)

After that use it normally as you would use. GoogleSignIn doesn't work on mobile devices if you are using JS sdk or atleast of me it didn't work.

  • Related