我在使用expo的react-native应用程序中通过Firebase Javascript SDK使用Firestore,但从expo弹出后,即使我的设备已连接到互联网,我也会收到此错误:
@firebase/firestore: Firestore (7.19.1): Could not reach Cloud Firestore backend. Backend didn't respond within 10 seconds.
This typically indicates that your device does not have a healthy Internet connection at the moment. The client will operate in offline mode until it is able to successfully connect to the backend.
我该如何解决这个问题,或者我应该使用react-native-firebase包?
最佳答案
我可以通过在 firebase config.js 底部添加此行来解决此问题:
export const firebase = Firebase.initializeApp(firebaseConfig);
firebase.firestore().settings({experimentalForceLongPolling: true}); // add this
现在 firestore 按我的预期工作了
关于android - 弹出的 React Native 应用程序无法到达 Firestore 后端,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63766786/