[英]Firebase javascript v9 getMessaging().subscribeToTopic() undefined
[英]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
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.