Home > Software design >  How to add firebase sdk to React Native?
How to add firebase sdk to React Native?

Time:12-12

I am really close to the solution but I still don not get it. I want to start a new React Native project and use Firebase as a database and image storage.

The steps I took:

  1. I installed React Native
  2. I did "npm install@react-native-firebase/app"
  3. I created a new project "expo init react-native-firebase"
  4. I created a new FireBase project, then I started my project with Metro Bundler.

And after that it is unclear that how can achieve that my folder struckture looks like this with all the firebase sdk's in it:

What I want to achieve

My folder structure is missing all the dependencies for Firebase, like the android and ios folders etc.. I tried to cd into my project in the terminal, then ran "yarn add firebase", but that did not work. I can see the necessary files are in "C:/MyReactNativeProject/node_modules/@react-native-firebase/app/".

Currently my project looks like this:

my folder structure

What am i missing? :/

CodePudding user response:

Today, you can't have the Firebase react-native sdk with expo

As the react-native-firebase documentation says, you need to eject your app if you want to use this library with expo. Be mind that eject action is not reversible. But wish to make use of features such as Realtime Database (without offline support) & Authentication, you can still use the Firebase Web SDK in your project.

To use Firebase in expo Project, follow their docs

  • Related