Null 不是对象 RNGoogleSignin.SIgn_IN_CANCELLED React Native Expo Android

我在 React Native google 登录模块中遇到异常错误。这是错误中的完整代码片段

TypeError: null is not an object (evaluating 'RNGoogleSignin.SIGN_IN_CANCELLED')
export const statusCodes = {
  SIGN_IN_CANCELLED: RNGoogleSignin.SIGN_IN_CANCELLED,
  IN_PROGRESS: RNGoogleSignin.IN_PROGRESS,
  PLAY_SERVICES_NOT_AVAILABLE: RNGoogleSignin.PLAY_SERVICES_NOT_AVAILABLE,
  SIGN_IN_REQUIRED: RNGoogleSignin.SIGN_IN_REQUIRED,
};

在 node_modules@react-native-google-signingoogle-signinsrcGoogleSignin.ts

我无法找到解决方案。

这是我的代码片段

import React, { useState } from "react";
import { View, Text, StyleSheet, StatusBar } from "react-native";
import SplashBG from "../icons/splashbg";
import Logo from "../icons/logo";
import { GoogleSignin } from '@react-native-google-signin/google-signin';

const GetLoginStatus = async () => {
    GoogleSignin.configure({ webClientId: '265662725956-ukku7c59o0afjqpig79bdcsrdnai4063.apps.googleusercontent.com' });
    await GoogleSignin.hasPlayServices();
    const userInfo = await GoogleSignin.signIn();
    console.log(userInfo);

}

const Splash = () => {

    const userstatus = GetLoginStatus();

    return (
        <>

            <View style={styles.BGContainer}>
                <Text>Login Screen</Text>
            </View>

        </>
    );
}

export default Splash;

我的 React Native 版本 react-native@0.63.2 @react-native-google-signin/google-signin@7.0.0-alpha.3

我在android中收到此错误。我没有在 iphone 上检查过,但现在也可能出现同样的错误。

请帮忙。

stack overflow Null is not an object RNGoogleSignin.SIgn_IN_CANCELLED React Native Expo Android
原文答案

相关问题