Replies: 2 comments 5 replies
-
There is but it's still v8 API, using firebase-js-sdk in compat mode until the API here moves to v9 style https://github.com/invertase/react-native-firebase-authentication-example/blob/main/template/src/shims/firebase-analytics-web.ts That template is built on this one https://github.com/plaut-ro/luna And is my best take on sharing code (literally, just all same code base with one API) on web + mobile |
Beta Was this translation helpful? Give feedback.
-
react-native-firebase has firebase-js-sdk fallback support now so it should work on web, no shims needed: |
Beta Was this translation helpful? Give feedback.
-
Hi,
I did not found an answer to this yet, so hopefully somebody can point me into the right direction.
I already implemented several functions using Cloud Firestore (v8 and now migrated to v9), which I use in a ReactJS WebApp.
To be able to re-use them with minimal effort in my ReactNative App, I was planning to put these methods to a separate repository, import them in my WebApp (works fine) and also import and use them in my ReactNative app.
API seems similar enough at least do add, update and delete docs, so I gave it a try.
Separate
deleteDoc.js
file:ReactNative Project:
However, this gives me
FirebaseError: Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore
.In the WebApp, it works as expected.
Is there an elegant way to share firestore-related code between Web and ReactNative? Thanks in advance!
Beta Was this translation helpful? Give feedback.
All reactions