Skip to content
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

[firestore] Differences between official realtime updates and implementation #484

Closed
DavidKuennen opened this issue Oct 10, 2017 · 3 comments

Comments

@DavidKuennen
Copy link
Contributor

DavidKuennen commented Oct 10, 2017

I noticed some differences / complications for the implementation of realtime updates between react-native-firebase and the official docs.

Example Code:

firebase
    .firestore()
    .collection('rooms')
    .where(`users.${userId}`, '==', true)
    .onSnapshot((docs) => {
        docs.docChanges.forEach((change) => {
            // this is where it's different.. see below
        });
    });

I noticed the following differences when using docs.docChanges:

Official react-native-firebase
change.doc.data() change.doc.data
change.doc.id change.doc.path.split('/')[1] 😅
  1. Application Target Platform: only tested on android
  2. Development Operating System: Windows 10
  3. Build Tools: Android Studio
  4. React Native version: 0.48.4
  5. RNFirebase Version: 3.0.2
  6. Firebase Module: Firestore
@chrisbianca
Copy link
Contributor

@DavidKuennen Good spot! I've just resolved this and pushed up a change which will be released in our next patch release. In the meantime, you can try it out by doing the following:

npm install --save https://github.com/invertase/react-native-firebase.git

@DavidKuennen
Copy link
Contributor Author

Great, thanks @chrisbianca.
I can use it like I do right now, so I'll wait for the next release and then just switch out a few lines of code. 😉

@chrisbianca
Copy link
Contributor

This is now live as part of the v3.0.3 release

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants