【发布时间】:2021-05-27 20:37:59
【问题描述】:
我想在我的应用中使用 firebase 身份验证。在将所有文件配置到并在 Expo 上运行后,它给了我上述错误。
我的 authProvider 文件:
import React, { createContext, useState} from "react"
import auth from "@react-native-firebase/auth"
export const AuthContext = createContext();
export const AuthProvider = ({children}) => {
const [user, setUser] = useState(null);
return (
<AuthContext.Provider
value={{
user,
setUser,
login: async (email, password) => {
try{
await auth().signInWithEmailAndPassword(email, password);
}catch(e) {
console.log(e)
}
},
register: async (email, password) => {
try{
await auth().createUserWithEmailAndPassword(email, password);
}catch(e){
console.log(e)
}
},
logout: async() => {
try{
await auth().signOut()
} catch(e){
console.log(e)
}
}
}}
>
{children}
</AuthContext.Provider>
)
}
【问题讨论】:
标签: javascript android firebase react-native firebase-authentication