簡體   English   中英

某些功能顯示為未定義的 firebase/auth v9

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

我正在將我的代碼從 firebase v8 重寫到 v9,我正在看這個教程

我嘗試使用signInWithRedirect() function 然后使用getRedirectResult() function

我像導入其他函數一樣導入它們,但是當我使用console.log()時,我在控制台中undefined

這是我的代碼:

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:我得到的錯誤是TypeError: _auth.signInWithRedirect is not a function
firebase 版本在我的 package.json "firebase": "^9.6.0",

這里是 vscode IntelliSense 檢測到的 getAuth function
這里的 signInWithRedirect function 在我的控制台中顯示為未定義,但也被 IntelliSense 檢測到

沒有解決辦法:因為

React Native 不會導出 signInWIthPopup 和 signInWithReactNative 入口點,因為這兩個函數都直接修改 DOM

通過 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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM