Open When - An Expo + Firebase Firestore Platform

Hi, did you find a solution for this problem?


Hi guys,

Those who are testing on android but can’t get firestore to work, I’ve been there too. Here’s the stack overflow question I asked and got a working fix. There’s a deeper insight on the question, if you’re facing the problem.

But now I’m having a different problem, the one that @spettit faced. When I’m trying to enable offline persistence it won’t allow me. I get the following error printed on console:

“Error enabling offline storage. Falling back to storage disabled: FirebaseError: [code=unimplemented]: This platform is either missing IndexedDB or is known to have an incomplete implementation. Offline persistence has been disabled.”

Does anyone know any fix to it?

Thanks in advance

1 Like

In the end I built my app outside expo using react-native-firebase which implements offline persistence out of the box. I’ve not tried it on android but on iOS react-native-firebase does everything I want it to do.

I’ve used this solution to build my firestore app. However, recently I faced security rules are not working properly on this one. Anyone having same issue?

allow read, write: if request.auth != null;

Always failed getting document with request.auth != null option

releated issue is here.

Great to hear that you had such a positive experience.

I’m keen to migrate my app away from Firebase Realtime DB to Firestore, I had a quick crack at it but it’s mostly a rewrite of my actions and cloud functions :frowning: , and it didn’t seem like Firestore had solid support for React Native at the time.

Do you have an Expo link for iOS?

Thanks… it’s working (Y)

import firebase from "firebase"

// Initialize Firebase
var config = {
  apiKey: "XXXX",
  authDomain: "",
  databaseURL: "",
  projectId: "XXX",
  storageBucket: "",
  messagingSenderId: "XXXX"

var db = firebase.firestore();

    var db = firebase.firestore();
    var docRef = db.collection("users");
    const output = {};

		.then(querySnapshot => { (documentSnapshot) {
				return (output[] =;
      this.setState({dataSource: Object.entries(output)}) ;
      console.log("datasource:", this.state.dataSource );
1 Like

Are you getting a massive object as well? Cant work out if I’m doing something wrong or if thats the actual results


Does it work yet? I am not able to make it work. Please help me out.

It gives the error - TypeError: _firebase2.default.firestore is not a function. (In ‘_firebase2.default.firestore()’, ‘_firebase2.default.firestore’ is undefined)


1 Like

Have you imported firebase/firestore where you are calling firebase.firestore()



import '@firebase/firestore';

I’m having the same issue as well

TypeError: _firebase2.default.firestore is not a function. (In ‘_firebase2.default.firestore()’, ‘_firebase2.default.firestore’ is undefined)
even when using



import '@firebase/firestore';

Thanks for the help

1 Like

Hey did you get the solution for that even I am getting the same error.

Error: firebase.firestore is not a function. (In ‘firebase.firestore()’, ‘firebase.firestore’ is undefined)

P.S.: I have imported;
import * as firebase from ‘firebase’;
import ‘firebase/firestore’;

It works fine when I use firebase.database(), but I need to use firestore… all my data is in firestore could you help?

I solved it by using

import * as firebase from 'firebase/app';
import 'firebase/firestore';

I think how you import depends on your firebase version.

So what is the version of both the imports


Did you find a solution for this?

Is firestore working with expo and if yes with which firebase version? Because it’s not working with 7.14

It doesn’t work in 7.9.0 firebase version. I have tried all the solutions given above but still get firestore is not a function error.

I was able to fix doing the following:

  • Downgrading to firebase 7.9.0 (newer versions seem not to be fully compatible with expo)
  • using these import statements and initializations
import * as firebase from 'firebase'
import "firebase/firestore"
const db = firebase.firestore();
1 Like

I had the same problem, but the solution it isn’t downgrading the version for the firebase package. Searching on the internet and other people with the same error, I was found these:

  • The firefire firebase does not show any error messages and finding a solution is very difficult
  • The default configuration on firestore put false the condition rules for security, and this is the real problem.

Finally, the solution is changing the rule on the firestore.

rules_version = ‘2’;
service cloud.firestore {
match /databases/{database}/documents {
match /{document=**} {
allow read, write: if TRUE # change FALSE for TRUE

Expo + Firestore has become my go-to stack for all apps. I’ve built a number of libraries/products around it. In case it’s useful for anyone here:

1 Like