Expo React-Native EventEmitter.removelistener(' url',。):方法已被弃用。请改用返回的订阅中使用remove()
我已经搜索了一段时间,但我没有找到任何解决方案。
我正在使用Expo开发一个反应生态应用程序,并且正在使用Firebase使用Googlesignin和WebBrowser进行身份验证。
每当我使用Google签名时,我都会在Android上发出警告。
有什么想法如何删除此警告?
eventemitter.removelistener('url',...):方法已弃用。请改用
的订阅中remove()
在eventemitter.addlistener
remove() nofollow noreferrer“>
这是处理它的代码:
import { auth } from "../firebase";
import {
Text,
TextInput,
View,
StyleSheet,
TouchableOpacity,
Image,
ScrollView,
} from "react-native";
import { useTranslation } from "react-i18next";
import * as Google from "expo-auth-session/providers/google";
import {
getAuth,
GoogleAuthProvider,
signInWithCredential,
} from "firebase/auth";
import * as WebBrowser from "expo-web-browser";
import { useEffect, useState } from "react";
WebBrowser.maybeCompleteAuthSession();
export default function Login({ navigation }) {
const [email, setEmail] = useState("");
const [password, setPassword] = useState("");
const { t } = useTranslation();
const [request, response, promptAsync] = Google.useIdTokenAuthRequest({
expoClientId:"something.apps.googleusercontent.com",
webClientId:"something.apps.googleusercontent.com",
clientId:"something.apps.googleusercontent.com",
});
useEffect(() => {
if (response?.type === "success") {
const { id_token } = response.params;
const auth = getAuth();
const credential = GoogleAuthProvider.credential(id_token);
signInWithCredential(auth, credential);
navigation.navigate("ShowList");
}
}, [response]);
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论