React native 世博会第27届';I don’我好像不在世博会工作
对于世博会来说是新的,而且相对来说是新的反应,所以对于任何愚蠢的错误表示歉意 无论如何,尝试跟随AuthSession,允许用户登录google,然后google将继续通过firebase进行身份验证。目前,我只是想让第一部分工作起来 到目前为止,我的代码如下所示,当运行此程序时,不会出现任何窗口或任何东西,并且useEffect挂钩的响应为nullReact native 世博会第27届';I don’我好像不在世博会工作,react-native,expo,React Native,Expo,对于世博会来说是新的,而且相对来说是新的反应,所以对于任何愚蠢的错误表示歉意 无论如何,尝试跟随AuthSession,允许用户登录google,然后google将继续通过firebase进行身份验证。目前,我只是想让第一部分工作起来 到目前为止,我的代码如下所示,当运行此程序时,不会出现任何窗口或任何东西,并且useEffect挂钩的响应为null import * as Google from 'expo-auth-session/providers/google'; //other imp
import * as Google from 'expo-auth-session/providers/google';
//other imports
export default function LoginScreen() {
const [request, response, promptAsync] = Google.useAuthRequest({
expoClientId: 'Client-ID-From-Firebase.apps.googleusercontent.com'
/* iosClientId: 'GOOGLE_GUID.apps.googleusercontent.com',
androidClientId: 'GOOGLE_GUID.apps.googleusercontent.com',
webClientId: 'GOOGLE_GUID.apps.googleusercontent.com', */
});
useEffect(()=>{
if(response?.type === 'success'){
console.log("here")
console.log(response)
}else if (response?.type != 'success'){
//Gets here everytime
console.log("Failed")
console.log(response)
}
}, [response])
return(
<View style={styles.container}>
<Text style={styles.header}>Login</Text>
<View style={styles.innerContainer}>
<Entypo name="google--with-circle" size={80} color="red" style={styles.icon}
onPress={()=> promptAsync()}
/>
//Completely irrelevant code below
</View>
</View>
)
}
从“expo auth session/providers/Google”导入*为Google;
//其他进口
导出默认函数LoginScreen(){
const[request,response,promptAsync]=Google.useAuthRequest({
expoClientId:'来自Firebase.apps.googleusercontent.com的客户端ID'
/*iosClientId:'GOOGLE_GUID.apps.googleusercontent.com',
androidClientId:'GOOGLE_GUID.apps.googleusercontent.com',
webClientId:'GOOGLE_GUID.apps.googleusercontent.com'*/
});
useffect(()=>{
如果(响应?.type=='success'){
console.log(“此处”)
console.log(响应)
}else if(响应?.type!=“成功”){
//每次都来这里
console.log(“失败”)
console.log(响应)
}
}[答复])
返回(
登录
promptAsync()}
/>
//下面是完全无关的代码
)
}
试着通过世博会使用它。我的猜测是,其中一些仅用于web应用程序?任何帮助都将不胜感激
提前谢谢你
编辑:
它还返回一个警告:
可能未经处理的承诺拒绝(id:0):错误无法在未定义自定义架构的情况下深入链接到独立应用程序
但我的理解是,它应该在世博会中仍然有效