How to use the react-native-firebase.firestore function in react-native-firebase

To help you get started, we’ve selected a few react-native-firebase examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github birkir / hekla / src / utils / fetchMetadata.ts View on Github external
// import cheerio from 'react-native-cheerio'; // tslint:disable-line import-name
import { AsyncStorage } from 'react-native';
import { Sentry } from 'react-native-sentry';
import firebase from 'react-native-firebase';
import config from 'config';

let token;
const ref = firebase.firestore().collection('metadata');
const getKey = url => `MetaData_${url}`;

export const fetchMetadataCache = async (url: string) => {
  const cached = await AsyncStorage.getItem(getKey(url));

  try {
    if (cached) {
      return JSON.parse(cached);
    }
  } catch (err) {}

  return;
};

export default async (url: string) => {
github instamobile / react-native-starter-kit / src / screens / LoginScreen.js View on Github external
.then(result => {
        this.setState({ loading: false });
        var user = result.user;
        AsyncStorage.setItem("@loggedInUserID:id", user.uid);
        var userDict = {
          id: user.uid,
          fullname: user.displayName,
          email: user.email,
          photoURL: user.photoURL
        };
        var data = {
          ...userDict,
          appIdentifier: "rn-android-universal-listings"
        };
        console.log("data", data);
        firebase
          .firestore()
          .collection("users")
          .doc(user.uid)
          .set(data);
        this.props.navigation.dispatch({
          type: "Login",
          user: userDict
        });
      })
      .catch(error => {
github Bruno-Furtado / fastbuy-app / src / services / FirebaseService.js View on Github external
static productsCollection() {
    return firebase.firestore().collection('products');
  }
github BalestraPatrick / appbuilders18app / Contentful / ApiClient.js View on Github external
constructor() {
    this.firestore = firebase.firestore();
  }
github xaphod / LaneChange / app / utils / firebase.js View on Github external
const userObject = firebase.auth().currentUser;
  if (userObject) {
    user = userObject.uid;
  }

  const {
    date,
    notes,
    address,
    lon,
    lat,
    city,
    chosenCity,
  } = report;

  return firebase
    .firestore()
    .collection(reportsRefName())
    .add({
      date,
      notes,
      address,
      addressCity: city,
      lon,
      lat,
      chosenCity,
      image: firebaseImageURI,
      user,
    });
};