我在 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,
};
Run Code Online (Sandbox Code Playgroud)
在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);
} …Run Code Online (Sandbox Code Playgroud) 我遇到一个问题,当我单击 web 视图中的任何链接时,它会自动打开 chrome 浏览器并打开那里的链接
我在这里粘贴主要的活动类。
class MainActivity : AppCompatActivity() {
private val url = "https://stackoverflow.com/"
private lateinit var webView: WebView
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
webView = findViewById(R.id.webview)
// Get the web view settings instance
val settings = webView.settings
// Enable java script in web view
settings.javaScriptEnabled = true
// Enable and setup web view cache
settings.setAppCacheEnabled(true)
settings.cacheMode = WebSettings.LOAD_DEFAULT
settings.setAppCachePath(cacheDir.path)
// Enable zooming in web view
settings.setSupportZoom(false)
settings.builtInZoomControls = false
settings.displayZoomControls = false
// Zoom web …Run Code Online (Sandbox Code Playgroud)