I am working on a React native project that is connected to cloud firestore and I am using the latest version of Firebase package ^7.6.1, My Application is target both Android and iOS I tested the registration module through iOS and it works seamlessly with out problems when I tested it through Android Emulator (Google pixel 2) with Android version 9 Authentication works with out any problems but fetching data from any collection not working at all resulting in the following error:
[2019-12-31T09:25:11.274Z] @firebase/firestore: Firestore (7.6.0): Could not reach Cloud Firestore backend. Backend didn't respond within 10 seconds.
I have spent a day trying to figure out where might be the problem and I found the following thread: https://github.com/firebase/firebase-js-sdk/issues/283
But as noted "The original issue with xhr.send() on Android that this bug was tracking has been resolved in the March React Native release (0.55.0)." It's obvious that the issue is now resolved.
I found this question also:
Call to firestore collection() not working on expo
but I have to downgrade to an old version of Firebase 4.6.2 that for sure have many dependencies that is deprecated.
Here is my code sample:
try {
const response = await firebase.auth().signInWithEmailAndPassword(email, password);
const document = await firebase.firestore().collection('users').doc(response.user.uid).get();
props.navigation.navigate('AppMain');
} catch (error) {
console.log(error);
}
Here is Security Rules:
rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
// Extended the expire date
// This rule allows anyone on the internet to view, edit, and delete
// all data in your Firestore database. It is useful for getting
// started, but it is configured to expire after 30 days because it
// leaves your app open to attackers. At that time, all client
// requests to your Firestore database will be denied.
//
// Make sure to write security rules for your app before that time, or else
// your app will lose access to your Firestore database
match /{document=**} {
allow read, write: if true;
}
}
}
Do I miss something here? and If I have to deattach from Expo and use React Native Firebase package instead.