firebase 有人知道为什么我会得到这个错误,以及如何修复它吗?我已经尝试修复它几个小时了(expo & react native)[已关闭]

plicqrtu  于 2023-01-18  发布在  React
关注(0)|答案(1)|浏览(127)

**已关闭。**此问题需要debugging details。当前不接受答案。

编辑问题以包含desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem。这将有助于其他人回答问题。
9小时前关门了。
Improve this question
就像我无法绕过expo & react native中的这个错误一样,我使用的导入如下:

firebase.js:

import * as firebase from "firebase/app";
import { initializeApp } from "firebase/app";
import { getAnalytics } from "firebase/analytics";`

App.js

import firebase from '../firebase'

依赖关系:

`"@react-navigation/native": "^6.1.2",
"@react-navigation/native-stack": "^6.9.8",
"@react-navigation/stack": "^6.3.11",
"expo": "^45.0.0",
"expo-status-bar": "~1.3.0",
"firebase": "^9.15.0",
"react": "17.0.2",
"react-native": "0.68.2",
"react-native-maps": "1.3.2",
"react-native-safe-area-context": "4.2.4",
"react-native-screens": "~3.11.1"`

我试着安装firebase,改变依赖关系,用不同的方式导入,等等。
下面是我的文件结构:File Structure

o8x7eapl

o8x7eapl1#

Firebase最新版本的依赖关系如下所示:

"@react-native-firebase/analytics": "^16.4.6",
  "@react-native-firebase/app": "^16.4.6",

导入这些库,如下所示:

import analytics from '@react-native-firebase/analytics';

要使用它如下:

function App() {
  return (
    <View>
      <Button
        title="Add To Basket"
        onPress={async () =>
          await analytics().logEvent('basket', {
            id: 3745092,
            item: 'mens grey t-shirt',
            description: ['round neck', 'long sleeved'],
            size: 'L',
          })
        }
      />
    </View>
  );
}

相关问题