首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >无法从React(V6)Firestore获得数据:未定义不是一个函数(接近‘...this._firestore.native.collectionGet.’)

无法从React(V6)Firestore获得数据:未定义不是一个函数(接近‘...this._firestore.native.collectionGet.’)
EN

Stack Overflow用户
提问于 2019-11-29 12:19:24
回答 3查看 4.3K关注 0票数 15

我在这个问题上被困太久了。我刚刚开始在我的本机应用程序中使用react-本机-firebase实现Firestore。我只是在跟踪docs [https://invertase.io/oss/react-native-firebase/v6/firestore/quick-start#reading-data],但它对我不起作用。

这是在Android里。还没有在iOS上进行测试。

我一直在犯这个错误:

[TypeError: undefined is not a function (near '...this._firestore.native.collectionGet...')]

以下是相关代码:

代码语言:javascript
运行
复制
import React, {Component} from 'react';
import { firebase } from '@react-native-firebase/firestore';

export default App extends Component{
  constructor(props) {
    super(props);

    this.getData= this.getData.bind(this)
    this.getData()

    this.state = {};
  }

  async getData() {
    try {
      const querySnapshot = await firebase.firestore()
      .collection('Gyms')
      .get() //error with this

      console.log('Documents', querySnapshot.docs);

    } catch (e) {
      console.log(e);
    }
  }
}

任何帮助都将不胜感激!

EN

Stack Overflow用户

发布于 2021-09-03 07:24:55

当重新绑定并重新启动android dev server时,此问题将得到解决。

票数 1
EN
查看全部 3 条回答
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/59104680

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档