Can Firebase work offline with React Native?

I have an existing iOS app that I would like to add to some React Native screens. The app uses Firebase with support enabled to make it work offline. Is there a way to use Firebase directly inside React Native while maintaining standalone functions?

If the answer is yes, do iOS and React Native run the same local data store? This would be important, so changes to offline data on iOS screens would reflect data changes made on React Native screens, and vice versa.

Thank you for sharing your understanding!

+5
source share
4 answers

The Javascript SDK will save new recording requests when you are offline, and will sync with the server after it is connected online. But if you were hoping to show a list with data that was previously received from firebase, you were out of luck with Javascript. One answer mentions Firestack, but it is no longer supported.

In the project, I just finished installing this package https://github.com/invertase/react-native-firebase . This is the bridge for native ios and the Android SDK for firebase, and if you use it, you can also use persistence.

Tested and verified. Everything works great! :)

+3
source

Alternatively, you can use Firestack , which is a native library that works with both iOS and Android based on the reaction.

Offline support is included with the repository, real-time database, authentication, remote configuration (in development), etc.

(disclosure: I am one of the main authors of Firestack)

+10
source

Firebase's stand-alone hard drive is currently only available in its native iOS and Android SDK. It is not yet available for the JavaScript SDK.

+4
source

UPDATE:

COI:

  • Like Firebase JavaScript SDK 3.1.0, standalone resistance is still not available . He recommended using React Native AsyncStorage .
+1
source

Source: https://habr.com/ru/post/1243726/


All Articles