如何修复RN GoogleSignin模块链接.

use*_*354 10 react-native

每当我使用纱线时,一切都会爆炸,这是反应原生社区给出的指示.

我已经尝试过做npm install --save然后使用link命令但到目前为止没有任何工作.

我究竟做错了什么?以及如何解决这个问题.

onsole.error: "RN GoogleSignin native module is not correctly linked. Please read the readme, setup and troubleshooting instructions carefully or try manual linking."
Run Code Online (Sandbox Code Playgroud)

use*_*354 2

经过 2 天的修补后,我放弃了 React googlesignin 的东西。我只是按照 firebase 指南和 expo 指南进行操作,一切正常。

Expo google 登录获取凭据,然后 firebase 检查凭据并让您登录。

如果你正在做一个 firebase googlelogin 的事情并且你已经有了 firebase 设置你可以做一些事情

googleLogin = async () => {
      try {
        const result = await Expo.Google.logInAsync({
          androidClientId: "Your Client ID",
          //iosClientId: YOUR_CLIENT_ID_HERE,  <-- if you use iOS
          scopes: ["profile", "email"]

        })
        if (result.type === "success") {
          const credential = firebase.auth.GoogleAuthProvider.credential(result.idToken, result.accessToken);
             firebase.auth().signInAndRetrieveDataWithCredential(credential).then(function(result){
               console.log(result);
             });
     this.props.navigation.navigate('Where you want to go');
   } else {
     console.log("cancelled")
   }
      } catch (e) {
        console.log("error", e)
      }
  }
Run Code Online (Sandbox Code Playgroud)

  • 很高兴你让它工作了,但是使用完全不同的东西并不是一个解决方案,尤其是对于来这里寻求问题答案的人来说。 (2认同)