9

I'm trying to integrate Firebase into my expo app using the react-native-firebase framework which has several advantages over the regular firebase package when it comes to react-native apps.

However, I'm running into difficulties since the instructions say I must add the GoogleService-Info.plist to ios/[YOUR APP NAME]/GoogleService-Info.plist, and expo apps don't have an ios folder from what I understand.

Am I pretty much screwed or is there a solution for this?

Salakar
  • 6,016
  • 2
  • 18
  • 24
MarksCode
  • 8,074
  • 15
  • 64
  • 133

6 Answers6

10

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. More info here and here and here.

If you use Expo and would like to use this package, you'll need to eject. If you do not want to eject, 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.

bennygenel
  • 23,896
  • 6
  • 65
  • 78
3

Today, you can't have the Firebase react-native sdk with expo. And this is not planned according to: https://expo.canny.io/feature-requests/p/full-native-firebase-integration.

So you have to play only with the javascript sdk from Firebase.

Cloud Firestore is new, it will be better for the javascript sdk for offline and sync.

Wandrille
  • 6,267
  • 3
  • 20
  • 43
  • I know! I needed it too. – Wandrille Oct 05 '17 at 18:21
  • So what am I giving up by using the regular firebase sdk? Performance, offline, and what else? – MarksCode Oct 05 '17 at 18:24
  • check here: https://github.com/invertase/react-native-firebase. But that Firestore, offline, performance will change with the new Cloud Firestore – Wandrille Oct 05 '17 at 18:26
  • Do you know how annoying it is to develop once you've ejected? Is it pretty much the same or is it way more cumbersome? – MarksCode Oct 05 '17 at 18:34
  • I haven't tried. Expo is very usefull so i'm working with the javascript sdk. And if you want to eject, you can directly go to other starterkit like https://github.com/infinitered/ignite – Wandrille Oct 05 '17 at 18:35
2

The author of this thread: Fresh Detached Expo + RNFirebase not running on Android has managed to get it working with the Detached ExpoKit - so it's not a full ejection and keeps the expo features.

I have asked for the steps he took so we can see about getting something added to our docs and possibly a Detached ExpoKit version of our starter app.

See the expokit detaching docs for information about ExpoKit.

Salakar
  • 6,016
  • 2
  • 18
  • 24
2

It's in progress --

https://blog.expo.io/using-firebase-in-expo-e13844061832

Using Firebase in Expo And how we plan on adding it to the client We are super excited to announce that we will be rolling out a suite of Unimodules that will provide you with easy access to native Firebase features! initially you will only be able to use these in a detached ExpoKit App. But over time we will be working to add these to vanilla Expo.

TL;DR
Here are the modules, you will need to detach to add them for now:

  • App/Core
  • Analytics
  • Authentication
  • Cloud Firestore
  • Cloud Functions
  • Instance ID
  • Performance Monitor
  • Realtime Database
  • Cloud Storage
  • Remote Config
  • Firebase Cloud Messaging
  • Remote Notifications
  • Dynamic Linking
  • Invites
  • Crashlytics

Also TL;DR
Here is a boilerplate: https://github.com/EvanBacon/expo-native-firebase

MattPark
  • 377
  • 1
  • 2
  • 13
  • 1
    Thanks for the downvotes. The 2 top answers state that this is impossible and work isn't planned but a new blog post says this capability will be coming out soon. – MattPark Dec 03 '18 at 16:02
  • 2
    The blog post linked here has been updated with a comment that the planned integration of Expo and react-native-firebase isn't going to work. – James Mulholland May 19 '19 at 06:59
2

Update 02-12-2021

Guys expo's eas-build is now public. You can add custom native codes and use react-native-firebase. Here is the link to a youtube tutorial. The video is short and super easy to follow. Here is the link to the docs

Previous answer

If you are using Firebase using the mobile configuration, it does not work, but it worked smoothly when I tried the web configuration. Here is the youtube tutorial. Watch from 38:20 to set up.

Ayush Kumar
  • 494
  • 1
  • 6
  • 21
1

I managed to get a working set of react-native with redux, firestore and expo. See Code example at Github.

But it costs the offline-persistence (see https://github.com/firebase/firebase-js-sdk/issues/436). So from my point of view it costs performance, because i need to be online to get a full working app with firestore and react-native.

Matthias Wegner
  • 303
  • 4
  • 18