【问题标题】:Unable to set firestore().settings({ timestampsInSnapshots: true }) in App无法在 App 中设置 firestore().settings({ timestampsInSnapshots: true })
【发布时间】:2018-09-29 18:39:37
【问题描述】:

我试图将此语句添加到我的应用程序以忘记已知警告:

存储在 Firestore 中的 Date 对象的行为将发生变化 并且您的应用程序可能会中断...

我写过:

import * as firebase from 'firebase';
import '@firebase/firestore';

export default class App extends React.Component {
      componentWillMount() {
        const config = {
          apiKey: '...',
          authDomain: '...',
          databaseURL: '...',
          projectId: '...',
          storageBucket: '...',
          messagingSenderId: '...'
        };

        firebase.initializeApp(config);

        const settings = { timestampsInSnapshots: true };

        firebase.firestore().settings(settings);
      }

这是许多人建议的方式,比如这个答案:

Firebase update error: The behavior for date objects stored in Firestore is going to change and your app may break1

我按照这里的建议做了,但我无法摆脱这个错误......

错误:FirebaseError:未知选项“timestampsInSnapshots”传递给 功能设置()。可用选项:主机、ssl、凭据

【问题讨论】:

    标签: react-native google-cloud-firestore


    【解决方案1】:

    在最新版本的最新 Firestore 中,例如版本 (7.14.0):不再需要设置“timestampsInSnapshots: true”,应将其删除。

    【讨论】:

      猜你喜欢
      • 2019-07-04
      • 2019-07-11
      • 1970-01-01
      • 2019-09-03
      • 2023-04-07
      • 2018-05-27
      • 1970-01-01
      • 2018-11-20
      • 1970-01-01
      相关资源
      最近更新 更多