Firebase offline support

Hey,
is there already a solution to use firestorm’s or real-time-database’s offline mode in the managed workflow?
As far as I know, it is not supported in the Firebase JS SDK .

If not, do you have any other idea how to solve this problem?

Thanks

Hey, afaik Firebase Web (JS) SDK supports offline mode at least for Firestore DB. The docs seem to confirm it.

For the web, offline persistence is disabled by default. To enable persistence, call the enablePersistence method.

Regarding native (mobile SDK) the answer is yes and no :slight_smile: When using Expo Go downloaded from App/Play Store, you can only use Firebase JavaScript SDK. And this is the only one supported by expo build.

But, when using EAS Build (or building locally with expo run commands), you can setup react-native-firebase library in your project thanks to config plugins. There’s already a with-rn-firebase plugin published, which does the job and you don’t have to touch any native code.
Tbh you’re asking a week too early :wink: The situation is gonna be much better very soon, and moreover I’m writing an article on how to integrate the native Firebase with Expo custom managed workflow. Stay tuned, I’ll let you know in about a week.

1 Like

Are there any limitations using firebase web instead of react-native-firebase?

That sounds perfect.
I need this feature in about 5 weeks.

Please send me the link of your article.
Thanks in advance!

Besides some mobile-specific features, the main limitation is performance. Firebase Web is optimized for web and not directly intended to be used on mobile. It is fully written in JavaScript - each Firebase call blocks the JavaScript thread and makes your app slower when you’re doing lots of other stuff in your JS code.
The react-native-firebase uses native mobile Firebase SDKs for Android and iOS written in Java/Kotlin and Obj-C respectively. They’re designed for both platforms independently and give almost full native experience.

1 Like

Hello, along with SDK 42, the Development Clients have been released (the feature I was talking about) - It allows you to build your own, custom “Expo Go” that includes react-native-firebase (and any other native library you want).
I’ve also written the article describing the Dev Client and Firebase setup. You can find it at this link. Generally, all you have to do is to install 3 npm packages: expo-development-client, react-native-firebase and with-rn-firebase, then build your dev client, and you’re ready to go.

2 Likes