1

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();
shubham
  • 257
  • 2
  • 10
Wiezalditzijn
  • 443
  • 3
  • 17
  • check if this [thread](https://stackoverflow.com/questions/50555275/react-native-objects-are-not-valid-as-a-react-child-found-object-with-keys?noredirect=1&lq=1) works for you – shubham Dec 04 '18 at 18:10

1 Answers1

1

Hi you can use firebase 4.9.1 npm install --save firebase@4.9.1

Tayfun
  • 11
  • 3