Skip to content

Instantly share code, notes, and snippets.

@brentvatne
Created March 14, 2019 02:29
Show Gist options
  • Save brentvatne/9038b16b4f42a21cea40ad5c35fdb74c to your computer and use it in GitHub Desktop.
Save brentvatne/9038b16b4f42a21cea40ad5c35fdb74c to your computer and use it in GitHub Desktop.
Archiving expo-firebase

We started building expo-firebase based off of react-native-firebase in order to attempt to get it to work well within the Expo client. It turned out that there wasn't a good way to do this - the SDK fully expects that there is one binary per app, and the Expo client has multiple apps inside of it. We weren't able to work around this.

If you'd like to use Firebase in the Expo client with the managed workflow, we'd recommend using the Firebase JS SDK. It supports Firebase Realtime Database and Firebase Storage. If you'd like access to the full suite of native firebase tools, we recommend using the bare workflow and react-native-firebase, because we cannot support this in the Expo client currently.

@brentvatne
Copy link
Author

@koenpunt - i imagine that the web google analytics js sdk, which people are using with expo currently, will continue to work. it seems that they will just sunset the google analytics native mobile sdks. but i do not work for google so i cannot say, feel free to reach out to them and update us here

@oriharel
Copy link

Btw @brentvatne, I suggest you remove this doc -
https://docs.expo.io/versions/latest/guides/using-firebase/
right?

@nandorojo
Copy link

Btw @brentvatne, I suggest you remove this doc -
https://docs.expo.io/versions/latest/guides/using-firebase/
right?

These docs are for the firebase JS SDK which works with managed expo projects.

@anka-213
Copy link

Oh, this is really sad news. :(

@brentvatne
Copy link
Author

@oriharel - indeed, as @nandorojo pointed out you can continue using the JS SDK just fine with managed projects!

@EKoetsjarjan
Copy link

EKoetsjarjan commented Sep 2, 2019

I have upgraded to sdk 34 now (ejected project), anyone tried to use the react-native-firebase using sdk 34?
I need this for offline support

@nandorojo
Copy link

@EKoetsjarjan I haven’t ejected so I haven’t used it. That said, I’ve been using a hacky workaround to get Firestore to work offline with Expo and the Firebase JS SDK.

I wouldn’t recommend using this in production yet since I’ve only tested it for about a day so far. That said, it’s been working for me on a managed expo project with firestore’s offline persistence! I’d love your help testing it out.

Here’s a gist:
https://gist.github.com/zwily/e9e97e0f9f523a72c24c7df01d889482

@kuriel-trivu
Copy link

is there documentation for Expo Firebase Analytics? (if yes, too hard to find)

@nandorojo
Copy link

is there documentation for Expo Firebase Analytics? (if yes, too hard to find)

@kuriel-trivu Firebase Analytics requires react-native-firebase (and thus won't work on a managed expo project). However, I think that it works out-of-the box on Android devices when you're using the firebase JS SDK on a managed expo project. I'm not certain about this, so I don't want to give you the wrong answer, but in my experience, users with Android automatically show up on Firebase Analytics.

Are you able to test out an Android device and see if the same happens for you?

@kuriel-trivu
Copy link

kuriel-trivu commented Sep 12, 2019

I think that was in past, now, Expo sdk 34 has Firebase again in the expo-modules way.

we added firebase as documentation says, but there is no details about how to use Firebase Analytics

https://docs.expo.io/versions/latest/guides/using-firebase/#firebase-sdk-setup
https://docs.expo.io/versions/v34.0.0/guides/using-firebase/#firebase-sdk-setup (v34.0.0)

The docs only mentions Analytics but no more info

image

@StefKors
Copy link

StefKors commented Oct 2, 2019

I was also wondering about this. it mentions analytics without explaining or linking to docs

@nandorojo
Copy link

My best guess is that the mention of analytics is from a previous SDK. Expo only supports the firebase JS SDK in a managed project.

@smontlouis
Copy link

Analytics web is out. Unfortunately there is an error "document is not defined" when trying to use firebase analytics web in Expo

@StefKors
Copy link

StefKors commented Oct 4, 2019

Yeah I also haven't found a workaround, I ended up going with this package and it works well enough https://github.com/ryanvanderpol/expo-analytics

@brentvatne
Copy link
Author

this is a good issue to comment on to discuss firebase analytics in managed expo projects: firebase/firebase-js-sdk#2244

@ashley00101010
Copy link

This is the end of the expo horizon! :o

@nandorojo
Copy link

nandorojo commented Dec 9, 2019

I know this might not be your ideal answer, but the Segment / expo-segment integration is pretty nice. It does still require a work-around for expo web, including customizing the index.html file and a few other small details, but I'm sure that will get worked out soon enough.

@fparhat-rbi
Copy link

fparhat-rbi commented Feb 14, 2022

If someone wanted to enable Crashlytics or Firebase Performance traces, is the only way via config-plugins and creating new custom expo modules?

Has anyone successfully integrated Crashlytics of Firebase Performance into their expo applications thus far?

@nandorojo
Copy link

you can now use react-native-firebase with config plugins, I would do that

@raiss
Copy link

raiss commented Mar 18, 2022

@nandorojo does it mean the expo doesn't need to be ejected?

@nandorojo
Copy link

basically. you should learn about expo config plugins and custom dev clients

@daurelien
Copy link

@nandorojo
i'm using expo app, added expo-firebase-analytics to get analytics with js sdk. (it work)
I also want to get crashlytics but the expo library (expo-crashlytics) is deprecated ... any issue ?
(i can't eject expo)

@ansh
Copy link

ansh commented Sep 20, 2022

@nandorojo Do you have a config plugin for react-native-firebase?

@nandorojo
Copy link

the official library does.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment