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.

@cmacdonnacha
Copy link

@jellevdvliet I just followed the docs available here: https://firebase.google.com/docs/firestore

What you want is the web sdk.

@vpontis
Copy link

vpontis commented Jun 9, 2019

Thanks for the update here Brett!

I am using expo-firebase on an Expo SDK 32 version. I'm going to try bumping the Expo SDK to 33 and keeping expo-firebase. We will see how this goes...

I plan on switching from expo-firebase to react-native-firebase in the future.

@cmacdonnacha
Copy link

cmacdonnacha commented Jun 11, 2019

@vpontis, I'm not 100% sure but in order to use react-native-firebase I'm pretty sure you need to eject.

@vpontis
Copy link

vpontis commented Jun 12, 2019

@vpontis, I'm not 100% sure but in order to use react-native-firebase I'm pretty sure you need to eject.

Yes, you do. You also need to eject for the old expo-firebase package.

@hotaryuzaki
Copy link

hotaryuzaki commented Jun 17, 2019

i Almost spending 3 weeks to setup RN Firebase in expokit, but still.
I do not get any solution until now.
Error to error comes through.

My problem now,
If im using npm start,
when apps starts showing error:
RN Firebase core module was not found natively on android, ...
(but i can confirm i already setup correctly)

If I'm using react-native run-android,
build success but then got error:
java.lang.SecurityException: Permission Denial: starting Intent { flg=0x10000000 cmp=host.exp.exponent/.MainActivity } from null (pid=20229, uid=2000) not exported from uid 10274

is there any one who had same problem?

@yashlinmaistry
Copy link

@vpontis

I am using expo-firebase on an Expo SDK 32 version. I'm going to try bumping the Expo SDK to 33 and keeping expo-firebase. We will see how this goes...

I plan on switching from expo-firebase to react-native-firebase in the future.

I did it pan out for you?

I'm moving our expokit app to 33 this weekend. Do you recommend we also move to react-native-firebase?

@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