Issues between react-native app and firebase

Hi!
I have weird issue. I am creating react native app with Expo and Firebase. I had added support for BackHandler, it worked very well by the time. When I imported firebase to my project, BackHandler stopped work (closes app).

I have detected that it’s caused by one import line:
import * as firebase from "firebase";

(I added only import line to my App.js file, no functions inside component)

It’s so weird, isn’t it? Do you have any ideas what can I do?

expo → 28.0.0
firebase → 5.2.0
react → 16.3.1
react-native → 0.56

----- EDITED -----
I installed firebase 4.10.0, and now it works.

1 Like

glad you figured it out!

hi,

I had the same issue and thought it was a react-navigation bug but it seems to be Expo related.

If you want to get firebase 5.2.0 running with BackHandler / AndroidBackButton use imports like this:

import firebase from "@firebase/app"
import "firebase/auth"
import "firebase/database"
...

more infos here:
https://github.com/react-navigation/react-navigation/issues/4364

4 Likes

That saved my day. Thanks for sharing.

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.