【问题标题】:React-native firebase 5.6.0 Objects are not valid react childReact-native firebase 5.6.0 对象无效反应子
【发布时间】:2019-05-06 03:42:27
【问题描述】:

我有一个关于 react native + 导入 firebase 的问题。我收到以下错误:

React native - 对象作为 React 子对象无效(发现:对象与键 {$$typeof, type, key, ref, props, _owner, _store})

我查看了问题: React native - objects are not valid as a React child (found: object with keys {$$typeof, type, key, ref, props, _owner, _store}) 但是给定的解决方案不起作用。

我在一个单独的组件中导入了 firebase。我将导入从
import firebase from 'firebase' 更改为 import firebase from '@firebase/app'

但这无论如何都行不通!有人可以告诉我为什么并解释我必须如何更改代码才能使其正常工作吗?

注意:将版本从 firebase 从 5.6.0 更改为 5.0.3 有效,但我想使用最新版本的 firebase,只是因为我希望我的应用程序始终是最新的。

依赖:

"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"
},

代码

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();

【问题讨论】:

  • 检查这个thread是否适合你

标签: reactjs firebase react-native version


【解决方案1】:

您好,您可以使用 firebase 4.9.1 npm install --save firebase@4.9.1

【讨论】:

    猜你喜欢
    • 2018-11-16
    • 1970-01-01
    • 2020-04-26
    • 2020-07-25
    • 2019-08-21
    • 2018-08-08
    • 2019-08-18
    • 2022-09-27
    • 1970-01-01
    相关资源
    最近更新 更多