From c00c1329272fc1062622c675273505b7908d38e6 Mon Sep 17 00:00:00 2001 From: Salakar Date: Wed, 4 Oct 2017 21:18:20 +0100 Subject: [PATCH] [docs] misc tweaks to docs --- docs/core/config-default-app.md | 2 +- docs/core/config-rnfirebase.md | 3 +++ docs/modules/firestore.md | 24 ++++++++++++++++++++++-- 3 files changed, 26 insertions(+), 3 deletions(-) diff --git a/docs/core/config-default-app.md b/docs/core/config-default-app.md index 9ec3a9ce..40a0ed6a 100644 --- a/docs/core/config-default-app.md +++ b/docs/core/config-default-app.md @@ -2,7 +2,7 @@ ### Enable Database Persistence -Enabling database persistence (setPersistence) via JS for the default is no longer supported. This breaking change was added in v3 to prevent several race condition issues. +Enabling database persistence (setPersistence) via JS for the default app is no longer supported. This breaking change was added in v3 to prevent several race condition issues around. You can still however easily enable this natively for the default app instance: diff --git a/docs/core/config-rnfirebase.md b/docs/core/config-rnfirebase.md index b18a4228..3dd6e5cd 100644 --- a/docs/core/config-rnfirebase.md +++ b/docs/core/config-rnfirebase.md @@ -1,5 +1,8 @@ ### Log Options +TODO - PR's welcome + ### Debug Options +TODO - PR's welcome diff --git a/docs/modules/firestore.md b/docs/modules/firestore.md index 6f8b3a0b..d49da302 100644 --- a/docs/modules/firestore.md +++ b/docs/modules/firestore.md @@ -4,9 +4,9 @@ RNFirebase mimics the [Firestore Web SDK](https://firebase.google.com/docs/reference/js/firebase.firestore), whilst providing support for devices in low/no data connection state. -All Firestore operations are accessed via `firestore()`. +All Firestore operations are accessed via `firestore()`. For detailed documentation of the supported methods demonstrated below please use the official firestore web sdk guides. -Please note that Persistence (offline support) is enabled by default with Firestore on iOS and Android. +?> Please note that Persistence (offline support) is enabled by default with Firestore on iOS and Android. ## Add and Manage Data @@ -14,6 +14,8 @@ Please note that Persistence (offline support) is enabled by default with Firest Read information about a collection example: ```javascript +import firebase from 'react-native-firebase'; + firebase.firestore() .collection('posts') .get() @@ -31,6 +33,8 @@ firebase.firestore() Add to a collection example (generated ID): ```javascript +import firebase from 'react-native-firebase'; + firebase.firestore() .collection('posts') .add({ @@ -44,6 +48,8 @@ firebase.firestore() Add to a collection example (manual ID): ```javascript +import firebase from 'react-native-firebase'; + firebase.firestore() .collection('posts') .doc('post1') @@ -60,6 +66,8 @@ firebase.firestore() There are multiple ways to read a document. The following are equivalent examples: ```javascript +import firebase from 'react-native-firebase'; + firebase.firestore() .doc('posts/posts1') .get((documentSnapshot) => { @@ -76,6 +84,8 @@ firebase.firestore() Create a document example: ```javascript +import firebase from 'react-native-firebase'; + firebase.firestore() .doc('posts/posts1') .set({ @@ -89,6 +99,8 @@ firebase.firestore() Updating a document example: ```javascript +import firebase from 'react-native-firebase'; + firebase.firestore() .doc('posts/posts1') .update({ @@ -101,6 +113,8 @@ firebase.firestore() Deleting a document example: ```javascript +import firebase from 'react-native-firebase'; + firebase.firestore() .doc('posts/posts1') .delete() @@ -114,6 +128,8 @@ firebase.firestore() Writes, updates and deletes to documents can be batched and committed atomically as follows: ```javascript +import firebase from 'react-native-firebase'; + const ayRef = firebase.firestore().doc('places/AY'); const lRef = firebase.firestore().doc('places/LON'); const nycRef = firebase.firestore().doc('places/NYC'); @@ -145,6 +161,8 @@ Coming soon Listen to collection updates example: ```javascript +import firebase from 'react-native-firebase'; + firebase.firestore() .collection('cities') .where('state', '==', 'CA') @@ -161,6 +179,8 @@ The snapshot handler will receive a new query snapshot every time the query resu Listen to document updates example: ```javascript +import firebase from 'react-native-firebase'; + firebase.firestore() .doc('posts/post1') .onSnapshot((documentSnapshot) => {