invertase / react-native-firebase

🔥 A well-tested feature-rich modular Firebase implementation for React Native. Supports both iOS & Android platforms for all Firebase services.
https://rnfirebase.io
Other
11.63k stars 2.2k forks source link

[🐛] Modular API discrepancies from firebase-js-sdk #7967

Open jin-qin opened 1 month ago

jin-qin commented 1 month ago

Issue

Observed some modular API discrepancies between react-native-firebase and firebase-js-sdk.

For example, DocumentSnapshot::exists() is declared as a function in firebase-js-sdk while it is defined as a boolean value in react-native-firebase. There are some similar cases but unfortunately I am not able to identify all of them.

This issue bothered me because I want to write platform-specific codes with firebase-js-sdk and react-native-firebase.

Say I have two wrapper files named firebase.native.ts (import react-native-firebase) and firebase.web.ts (import firebase-js-sdk), then I have another file named test-api.ts which imports either firebase sdk based on platform. In this file, it tries to read from Firestore and want to check if snapshot exists. I expect the usage like snapshot.exists() can work for both native and js environment while currently it cannot.

Kindly ask if someone can help fix them? Thank you so much!


russellwheatley commented 4 weeks ago

Hi, thanks for raising this. It would constitute a breaking change. I've raised this internally as we're thinking of having a breaking change in the nearish future, and this seems like it should be a part of that.

gregfenton commented 2 weeks ago

Note: the field .exists was a property in the Firebase Web Client SDK up to v8. It became a method .exists() in v9.