android - 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-signin\google-signin\src\GoogleSignin.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 上检查过,但现在也可能出现同样的错误。
请帮忙。
解决方案
推荐阅读
- python - 如何使用 youtube-dl 的 --add-header 选项?
- mysql - 本地计算机上 phpmyadmin 中的数据库导入问题
- python - 当有很多输出时使用哪个损失函数?
- flutter - Flutter json 解析失败,没有任何错误
- java - glfwSetCursorPos() 在 Windows 上不起作用
- javascript - 无法修复媒体控制器视频视图中的播放和暂停按钮
- spring-boot - 我们如何在 spring-boot 中配置子域?
- android - 如何将活动实例转换为 gson
- syntax-error - 获取语法错误
- c# - 如何测试取消 TokenSource 的方法?