React native - objects are not valid as a React child (found: object with keys {$$typeof, type, key, ref, props, _owner, _store})
I had this problem today. I ran a diff on the source code between 5.0.3 and 5.0.4 and found that the exports have changed. I also found that if I change the import statement to the following that it works with the latest version (5.3.0):
import firebase from '@firebase/app'
import '@firebase/auth'
Doing it this way will allow you to avoid the require
in the middle of your code, which is preferred imho.
Try this:
Remove the firebase import statement from App.js:
import firebase from 'firebase'
On Firebase initialization create a constant:
initializeFirebase() {
const firebase = require("firebase");
// Initialize Firebase
var config = {
...
};
firebase.initializeApp(config);
//inicializando o firestore
const firestore = require("firebase/firestore");
db = firebase.firestore();
db.settings({ timestampsInSnapshots: true });
}
componentWillMount() {
this.initializeFirebase();
...
}
To me this workaround works very well!
It's an issue with firebase version 5.0.6 whereas downgrading to a version will resolve this issue.for example try this
$ npm install --save [email protected]
If version 5.0.4 is also not working for you than try version 4.9.1 as this is what i am using and it resolved this issue for me
$npm install --save [email protected]