简体   繁体   English

某些功能显示为未定义的 firebase/auth v9

[英]Some functions appear as undefined firebase/auth v9

I was rewriting my code from firebase v8 to v9, i was watching this tutorial我正在将我的代码从 firebase v8 重写到 v9,我正在看这个教程

i try to use the signInWithRedirect() function followed by the getRedirectResult() function我尝试使用signInWithRedirect() function 然后使用getRedirectResult() function

i import them like i import my others functions but when i console.log() thoses i get undefined in my console我像导入其他函数一样导入它们,但是当我使用console.log()时,我在控制台中undefined

here is my code:这是我的代码:

import { View } from "react-native";

import firebase, { initializeApp } from 'firebase/app';

import { GoogleAuthProvider, useDeviceLanguage, signInWithCredential, onAuthStateChanged, getAuth, signInWithRedirect, getRedirectResult } from "firebase/auth";

const LoginSceen = (props) => {

  console.log(signInWithRedirect) //return undefined
  console.log(getRedirectResult ) //return undefined
 
  console.log(getAuth) //return [Function getAuth]
  console.log(GoogleAuthProvider) //return [Function GoogleAuthProvider]
  

  return (
    <View style={{ flex: 1, backgroundColor: "#9297C4" }}>

    </View>
  );
}

export default LoginSceen;

PS: the error i get is TypeError: _auth.signInWithRedirect is not a function PS:我得到的错误是TypeError: _auth.signInWithRedirect is not a function
firebase version in my package.json "firebase": "^9.6.0", firebase 版本在我的 package.json "firebase": "^9.6.0",

here the getAuth function detected by vscode IntelliSense这里是 vscode IntelliSense 检测到的 getAuth function
here the signInWithRedirect function who appear as undefined in my console but detected too by IntelliSense这里的 signInWithRedirect function 在我的控制台中显示为未定义,但也被 IntelliSense 检测到

There is no solution: since没有解决办法:因为

React Native does not export the signInWIthPopup and signInWithReactNative entrypoints since both of these functions directly modify the DOM React Native 不会导出 signInWIthPopup 和 signInWithReactNative 入口点,因为这两个函数都直接修改 DOM

by sam-gc 通过 sam-gc

And here the response i get from the Firebase team on my github isue: https://github.com/firebase/firebase-js-sdk/issues/5837#issuecomment-1005038520 And here the response i get from the Firebase team on my github isue: https://github.com/firebase/firebase-js-sdk/issues/5837#issuecomment-1005038520

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM