React native 谷歌登录世博会v32文档缺少代码?

React native 谷歌登录世博会v32文档缺少代码?,react-native,google-signin,expo,React Native,Google Signin,Expo,我基本上是按照文档来实现我的应用程序,但是,它给了我这个错误。我安装了他们的演示,它也出现了同样的错误 我在网上搜索了一下,到目前为止没有发现任何与这个问题有关的东西 import React, { Component } from 'react'; import { View, Text, Platform, ScrollView, Linking } from 'react-native'; import { Button, Card, Icon } from 'r

我基本上是按照文档来实现我的应用程序,但是,它给了我这个错误。我安装了他们的演示,它也出现了同样的错误

我在网上搜索了一下,到目前为止没有发现任何与这个问题有关的东西

    import React, { Component } from 'react';
    import { View, Text, Platform, ScrollView, Linking } from 'react-native';
    import { Button, Card, Icon } from 'react-native-elements';
    import { connect } from 'react-redux';
    import {Actions} from 'react-native-router-flux';
    import * as actions from '../actions';
    import { GoogleSignIn } from 'expo-google-sign-in';
    import { AuthSession } from 'expo';
    import * as Constants from 'expo-constants';
    import { AppAuth } from 'expo-app-auth';
    import GoogleSignInButton from './GoogleSignInButton';

    const { OAuthRedirect, URLSchemes } = AppAuth;
    class AuthScreen extends Component {
      state = { user: null };

      componentDidMount() {
        this.initAsync();
        }

        initAsync = async () => {
        await GoogleSignIn.initAsync({
          clientId: '1052072418841-6huufh0eq3mbo22ah7v8aml8esau9fvb.apps.googleusercontent.com',
        });
        this._syncUserWithStateAsync();
      };

      _syncUserWithStateAsync = async () => {
        const user = await GoogleSignIn.signInSilentlyAsync();
        this.setState({ user });
      };

        signOutAsync = async () => {
            await GoogleSignIn.signOutAsync();
            this.setState({ user: null });
          };

          signInAsync = async () => {
            try {
              await GoogleSignIn.askForPlayServicesAsync();
              const { type, user } = await GoogleSignIn.signInAsync();
              if (type === 'success') {
                this._syncUserWithStateAsync();
              }
            } catch ({ message }) {
              alert('login: Error:' + message);
            }
          };


        onPress = () => {
        if (this.state.user) {
          this.signOutAsync();
        } else {
          this.signInAsync();
        }
      };

      get buttonTitle() {
        return this.state.user ? 'Sign-Out of Google' : 'Sign-In with Google';
      }

    render()
    {
      return (
        // <View>
        // <Text>
        // Appauth: {JSON.stringify(AppAuth.URLSchemes, null, 2)}
        // </Text>
        // </View>

        <Card>
        <Button
        type='solid'
        title='Register'
        large
        backgroundColor='#00FFFF'
        onPress={() => Actions.register()}
        />
        <Button
        type='solid'
        title='Loging With Facebook'
        large
        backgroundColor='#00FFFF'
        onPress={() => this.props.facebookLogin()}
        />
        <GoogleSignInButton onPress={this.onPress}>
             {this.buttonTitle}
           </GoogleSignInButton>

        </Card>
      );

    }


    }

    export default connect(null, actions)(AuthScreen);
import React,{Component}来自'React';
从“react native”导入{视图、文本、平台、滚动视图、链接};
从“react native elements”导入{按钮、卡片、图标};
从'react redux'导入{connect};
从“react native router flux”导入{Actions};
将*作为动作从“../actions”导入;
从“谷歌登录世博会”导入{GoogleSignIn};
从“expo”导入{AuthSession};
从“expo常量”导入*作为常量;
从“expo app auth”导入{AppAuth};
从“./GoogleSignInButton”导入GoogleSignInButton;
const{OAuthRedirect,URLSchemes}=AppAuth;
类AuthScreen扩展组件{
状态={user:null};
componentDidMount(){
this.initAsync();
}
initAsync=async()=>{
等待GoogleSignIn.initAsync({
clientId:'105207241841-6huufh0eq3mbo22ah7v8aml8esau9fvb.apps.googleusercontent.com',
});
这是。_syncUserWithStateSync();
};
_SyncUserWithState异步=异步()=>{
const user=wait GoogleSignIn.signInSilentlyAsync();
this.setState({user});
};
signOutAsync=async()=>{
等待GoogleSignIn.signOutAsync();
this.setState({user:null});
};
signInAsync=async()=>{
试一试{
等待GoogleSignIn.askForPlayServicesSync();
const{type,user}=wait GoogleSignIn.signInAsync();
如果(类型=='success'){
这是。_syncUserWithStateSync();
}
}捕获({message}){
警报('登录:错误:'+消息);
}
};
onPress=()=>{
if(this.state.user){
this.signOutAsync();
}否则{
this.signInAsync();
}
};
拿扣子{
返回this.state.user?'Sign Out Google':'Sign In with Google';
}
render()
{
返回(
// 
// 
//Appauth:{JSON.stringify(Appauth.URLSchemes,null,2)}
// 
// 
Actions.register()}
/>
this.props.facebookLogin()}
/>
{这个.纽扣}
);
}
}
导出默认连接(空,操作)(AuthScreen);

我所需要的是,当点击谷歌登录时,它会显示谷歌登录屏幕。谷歌登录Expo v32只能在独立模式下工作,这意味着你应该首先构建和发布应用程序。不是很方便,但至少不是死胡同

详情如下:


也可以查看评论部分

谷歌登录Expo v32只能在独立模式下工作,这意味着您应该首先构建并发布应用程序。不是很方便,但至少不是死胡同

详情如下:

也可以查看评论部分