简体   繁体   English

使用 Login 登录需要 Button 点击​​两次才能打开 Google 登录页面 | 世博会| 世博会认证会议

[英]Signin with Login requires Button to click twice to open Google Login Page | Expo | Expo Auth Session

I have setup a login with google functionality in React Native App.我已经在 React Native App 中设置了一个使用谷歌功能的登录名。 The Login Button works and login works too, however the Login Button needs to be clicked twice to open "Sign In with Google" popup.登录按钮有效,登录也有效,但是登录按钮需要单击两次才能打开“使用 Google 登录”弹出窗口。

The function that handles login is available in my custom authentication hook and is called in of the child components named Login.处理登录的函数在我的自定义身份验证钩子中可用,并在名为 Login 的子组件中调用。

Authenication Hook:认证挂钩:

const SignInWithGoogle = () => {
    console.log("clicked");
    promptAsync()
    .then(async (response) => {
        if (response.type === "success") {
            const credential = GoogleAuthProvider.credential(
            null,
            response.authentication.accessToken
         );
         await signInWithCredential(auth, credential);
        }
   })
   .catch((error) => setError(error))
   .finally(() => setLoading(false));
};

Function called on Button click in Login.js在 Login.js 中单击按钮时调用的函数

 <Pressable
      style={{ backgroundColor: myColors.primary, padding: 20 }}
      onPress={SignInWithGoogle}
  >
    <Text>Login</Text>
  </Pressable>
  

Try doing it like so:尝试这样做:

<Pressable
      style={{ backgroundColor: myColors.primary, padding: 20 }}
      onPress={() => SignInWithGoogle}
  >
    <Text>Login</Text>
</Pressable>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在 android 上的开发中出现 Google 登录问题的 expo-auth-session - expo-auth-session with Google login problems in Development build on android 使用 Firebase 在 React Native Expo 应用程序中验证登录页面,但必须单击按钮两次才能执行完整的 function - Using Firebase to Authenticate login page in a React Native Expo App but have to click the button twice for the full function to execute 将Expo / Google登录信息链接到Firebase身份验证 - Link Expo/Google login to firebase auth 世博会,Firebase,使用Google登录 - Expo, Firebase, Login with google 同时使用Google Signin和Firebase身份验证需要登录两次? - Using both Google Signin and Firebase auth require login twice? Facebook 和 Google 需要两次登录点击才能使用 Firebase Auth 登录 - Facebook and Google requires two login click to login with Firebase Auth Firebase React Native Expo 谷歌登录错误 - Firebase React Native Expo login error with google 为什么 Firebase Auth Signin 和 login segue 被调用两次 - Why is Firebase Auth Signin and login segue being called twice 为什么我的 function 打不开 React Native (Expo) 的 Facebook 登录页面? - Why won't my function open up the Facebook Login page for React Native (Expo)? React Native Expo Google Sigin 使用 expo-auth-session 重定向问题 - React Native Expo Google Sigin Using expo-auth-session redirect issue
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM