我在这个问题上被困太久了。我刚刚开始在我的本机应用程序中使用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...')]
以下是相关代码:
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);
}
}
}任何帮助都将不胜感激!
发布于 2021-09-03 07:24:55
当重新绑定并重新启动android dev server时,此问题将得到解决。
https://stackoverflow.com/questions/59104680
复制相似问题