From what I've understood offline first apps need a way to tell if the user is connected; if not, it stores changes locally and syncs with the remote server when online.
The way I've found to do this with web apps is by using pouchdb on the client communicating with an api connected to a couchdb database. Or by using Firebase.
Is it possible to have similar functionality using React-Native? Maybe by using the pouchdb-async-storage adapter. Are there other alternatives out there for local-remote data syncing?
I build an AsycStorage Adapter for PouchDB, including Polyfills for React-native. Properly that helps.
asyncstorage adapter for PouchDB
I haven't actually implemented offline capabilities in a React-Native app but from looking at the docs, the APIs provided enable you to do so.
The APIs you're looking for are AsyncStorage (for data persistence) and to detect the connection info use NetInfo.
You're on the right track about using pouchdb. The part you will most likely have to write yourself is the syncing script (I'm not sure you can do this in the background but I may be wrong).
Let me know how you get on or if you want to discuss further @hugo__df on twitter :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With