Cloud Firestore 是否支持 React Native

Does Cloud Firestore support React Native

我目前将 Firebase 实时数据库用于我的本机反应移动应用程序,并且我一直在寻找一些提供更好查询功能的替代方案。 Firestore 的强项之一是其查询功能。我想检查 Firestore 是否支持开箱即用的 React Native。

React Native Firebase 的 10 月 3 日版本包括 Cloud Firestore 支持。

First pass at support for the newly release Cloud Firestore beta, see http://invertase.link/firestore for supported api's.

import firebase from 'react-native-firebase';

firebase.firestore()
  .collection('posts')
  .add({
    title: 'Amazing post',
  })
  .then(() => {
    // Document added to collection and ID generated
    // Will have path: `posts/{generatedId}`
  })

此外,您可以使用像 Firestorter 这样的库将您的 firestore 数据直接挂接到您的 React 组件:

https://github.com/IjzerenHein/firestorter

https://medium.com/@hrutjes/building-a-react-firestore-app-with-zero-effort-and-mobx-525df611eabf

Cloud firestore 支持此处列出的多个框架: https://firebase.google.com/docs/firestore/library-integrations

您也可以使用 invertase 的这个框​​架; https://rnfirebase.io/docs/v3.3.x/getting-started