나는 오랫동안이 문제에 갇혀있다. 방금 react-native-firebase를 사용하여 react-native 애플리케이션에서 Firestore를 구현하기 시작했습니다. 나는 단지 문서 [ https://invertase.io/oss/react-native-firebase/v6/firestore/quick-start#reading-data]를 따르고 있지만 그것은 나를 위해 작동하지 않습니다.
이것은 안드로이드에 있습니다. iOS에서 아직 테스트하지 않았습니다.
이 오류가 계속 발생합니다.
[TypeError: undefined is not a function (near '...this._firestore.native.collectionGet...')]
관련 코드는 다음과 같습니다.
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);
    }
  }
}
어떤 도움이라도 대단히 감사하겠습니다!
답변
기본 RNFirestore 모듈이 없기 때문에이 오류가 발생합니다.
을 사용 하여 재 구축 yarn @react-native-firebase/firestore을 실행 pod install하고 트리거 해야합니다 react-native run-ios.
답변
Firebase / Firestore 설정이 양호하여 검색어가 거짓이기 때문에 다음과 같이 테스트 할 수 있습니다.
import firestore from '@react-native-firebase/firestore';
firestore()
  .collection('collection')
  .onSnapshot((querySnapshot) => {
     console.log(querySnapshot)
  })
