Open When - An Expo + Firebase Firestore Platform

Huge shoutout to the Expo & Firebase Firestore team!

I don’t think I’ve ever had an easier time building a product than when I used both of these two platforms together.

Open When is a platform for exchanging quotes, advice, and life experiences.

Time spent fighting XCode/Android Studios: 0
Time spent linking libraries: 0
Time spent writing server-side code: 0
Time from project start to App Store release: 2 weeks
If this is the future of mobile development, I’m a big fan.

==Features==
-Animations
-Real-time commenting
-Pagination
-Sharing
-Voting
-Feed Filtering

5 Likes

This is great! Congrats on building this! Do you have an Expo link so we could try this project? Or a link to the app in the app stores?

1 Like

Whoops meant to include that. Here it is:

Open When- Community Letters:
https://itunes.apple.com/us/app/open-when-community-letters/id1298673377?mt=8

1 Like

Is Firestore supported by Expo?

1 Like

Yeah! And it is incredible…

1 Like

Do I have to eject my app? Also did you link Firebase Auth and Firestore?

1 Like

Nope. Not required. See my firebase.js:

const firebase = require("firebase");
require("firebase/firestore");

//Initializing firebase firestore
firebase.initializeApp({
    apiKey: "XXXXX",
    authDomain: "XXXX.firebaseapp.com",
    databaseURL: "https://XXXXX.firebaseio.com",
    projectId: "XXXXX",
    storageBucket: "XXXXX.appspot.com",
    messagingSenderId: "XXXXX"
});

export default firebase;

2 Likes

Import like this:

import firebase from './Firebase';

var db = firebase.firestore();

1 Like

Thank man :slightly_smiling_face:, I will look into it…

You sold us mate.
This is pretty impressive.
Now I am really gonna jump onto this :slight_smile:

can show more example on the code? i thought expo cant support it as we need to eject out for https://github.com/invertase/react-native-firebase

React-native-firebase is a great library, but not necessary for Firestore.

1 Like

what versions are you using? because I can`t seem to make it work… at all

I tried this, too - firestore works in Expo very easily as ishbaid said. But, as far as I can see, offline persistence is not implemented. If I specify ‘firebase.firestore().enablePersistence();’ I get a warning ‘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.’

Are you guys using ios or android? because on android I simply get no output at all… even on console.log… damn…

Here is an example of using Firebase with Expo:
https://snack.expo.io/HJ1Wjg95Z

2 Likes

yup… it works with RTDB for me too… that´s what I am using.

I can’t seem to get Firestore to work though…

I will create some code and share here… BRB

calling this:
var db = firebase.firestore();
var citiesRef = db.collection(“cities”);

citiesRef.doc("SF").set({
    name: "San Francisco", state: "CA", country: "USA",
    capital: false, population: 860000 });
citiesRef.doc("LA").set({
    name: "Los Angeles", state: "CA", country: "USA",
    capital: false, population: 3900000 });
citiesRef.doc("DC").set({
    name: "Washington, D.C.", state: null, country: "USA",
    capital: true, population: 680000 });
citiesRef.doc("TOK").set({
    name: "Tokyo", state: "null", country: "Japan",
    capital: true, population: 9000000 });
citiesRef.doc("BJ").set({
    name: "Beijing", state: null, country: "China",
    capital: true, population: 21500000 });

gets this error:
Module RCTDeviceEventEmitter is not a registered callable module (calling emit)

Hi @fweffort

Did you manage to get it working?

I’m having the same problem. I got firebase authentication working without any trouble, but can’t get firestore to work.

I saw your StackOverflow post and I’m getting the same thing: nothing.

I tried the suggestion that I install “@firebase/firestore” but that didn’t help.

(I’m testing on Android)

Any help is appreciated.

nope. still not working for me. :frowning:
i am usina rtdb meanwhilr