Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
402 views
in Technique[技术] by (71.8m points)

javascript - 无法从React-Native-Firebase(v6)Firestore获取数据:undefined不是一个函数(在'... this._firestore.native.collectionGet ...附近)(Can't get data from React-Native-Firebase(v6) Firestore: undefined is not a function (near '…this._firestore.native.collectionGet…'))

I've been stuck on this issue for so long.

(我已经在这个问题上停留了很长时间。)

I just started implementing Firestore in my react-native application with react-native-firebase.

(我刚刚开始使用react-native-firebase在我的react-native应用程序中实现Firestore。)

I'm just following the docs [ https://invertase.io/oss/react-native-firebase/v6/firestore/quick-start#reading-data] but it doesn't work for me.

(我只是关注文档[ https://invertase.io/oss/react-native-firebase/v6/firestore/quick-start#reading-data],但它对我不起作用。)

This is in Android.

(这是在Android中。)

Haven't tested in iOS yet.

(尚未在iOS中进行测试。)

I keep getting this error:

(我不断收到此错误:)

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

Here's the relevant code:

(以下是相关代码:)

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);
    }
  }
}


Any help would be much appreciated!

(任何帮助将非常感激!)

  ask by Akshat Jain translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...