-
Notifications
You must be signed in to change notification settings - Fork 64
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[React Native/ Expo only] Add offline support 👀 #2
Comments
Relevant discussion from SWR: vercel/swr#16 |
Wouldn't this be possible by just using the Firestore option of enablePersistence=true? |
Yeah! The only problem is that Firestore doesn't have persistence support for There is a work-around for React Native here: https://gist.github.com/zwily/e9e97e0f9f523a72c24c7df01d889482 and https://github.com/firebase/firebase-js-sdk/blob/3c8f85d0185e3305f0ba7790d46eebb8e9e78e62/packages/firestore/test/util/node_persistence.ts (though this one might be slow on RN) For more, see the original Firestore issue: firebase/firebase-js-sdk#436 |
Ah yes - I was thinking of this from a web perspective. But, you could use this https://rnfirebase.io/reference/firestore/settings for react-native :). |
Good call! Unfortunately that library doesn’t support Expo without detaching, so it will only work for Bare expo projects. A pure-JS solution for managed Expo apps specifically is what I’m hoping to achieve |
Solved this with https://github.com/nandorojo/expo-firestore-offline-persistence. Turned it into its own package. |
This issue only applies to mobile apps built with Expo. Firestore persistence works fine with this library with normal React.
Data should cache to
AsyncStorage
something like redux persist, and any mutations should somehow bubble up to happen later...🙃If anyone stumbles upon this, would love help.
The text was updated successfully, but these errors were encountered: