I have a question about react native + importing firebase. I got the following error:
React native - objects are not valid as a React child (found: object with keys {$$typeof, type, key, ref, props, _owner, _store})
I looked at issue: React native - objects are not valid as a React child (found: object with keys {$$typeof, type, key, ref, props, _owner, _store}) But the given solutions didn't work.
I imported the firebase in a seperate component. I changed the import from
import firebase from 'firebase' to import firebase from '@firebase/app'
But this doesn't work somehow! Can someone tell me why and explain how I have to change the code in order to make it work?
Note: Changing the version from firebase from 5.6.0 to 5.0.3 worked, but I want to use the most resent version of firebase, just because I want my app always to be up to date.
dependencies:
"dependencies": {
"firebase": "^5.0.3",
"react": "16.4.1",
"react-native": "0.55.4",
"react-native-action-button": "^2.8.4",
"react-native-elements": "^0.19.1",
"react-native-navigation": "^1.1.483",
"react-native-vector-icons": "^5.0.0",
"react-navigation": "^2.0.2410"
},
the code
import firebase from 'firebase';
// Initialize Firebase
const config = {
apiKey: "AIzaSyDKGnoKm2lzfDLLuxRU3eDgRKw0agy6vCc",
authDomain: "turfmeister-37808.firebaseapp.com",
databaseURL: "https://turfmeister-37808.firebaseio.com",
projectId: "turfmeister-37808",
storageBucket: "turfmeister-37808.appspot.com",
messagingSenderId: "312057996255"
};
firebase.initializeApp(config);
export const f = firebase;
export const database = firebase.database();
export const auth = firebase.auth();
export const storage = firebase.storage();
// These const are not used (yet).
// export const firestore = firebase.firestore();
// export const messaging = firebase.messaging();
// export const functions = firebases.functions();