@react-native-google-signin/google-signin/src/GoogleSignin.js 抛出异常 null is not an object(评估'RNGoogle
Posted
技术标签:
【中文标题】@react-native-google-signin/google-signin/src/GoogleSignin.js 抛出异常 null is not an object(评估\'RNGoogleSignin.SIGN_IN_CANCELLED\')【英文标题】:@react-native-google-signin/google-signin/src/GoogleSignin.js threw an exception null is not an object (evaluating 'RNGoogleSignin.SIGN_IN_CANCELLED')@react-native-google-signin/google-signin/src/GoogleSignin.js 抛出异常 null is not an object(评估'RNGoogleSignin.SIGN_IN_CANCELLED') 【发布时间】:2021-07-12 01:21:58 【问题描述】:我正在使用 firebase 为 firebase 项目实施 GoogleSign。我安装了这三个包:
"@react-native-firebase/app": "^11.3.0",
"@react-native-firebase/auth": "^11.3.0",
"@react-native-google-signin/google-signin": "^6.0.0",
然后在我的 Login.js 文件中,我将它们导入为:
import auth from '@react-native-firebase/auth'
import GoogleSignin from '@react-native-google-signin/google-signin';
那么在function Login(props)
里面我已经
GoogleSignin.configure(
webClientId: 'MY_WEB_CLIENT_ID.apps.googleusercontent.com'
);
但是一旦我运行我就会得到这个错误:
错误:需要模块 "node_modules/@react-native-google-signin/google-signin/src/GoogleSignin.js", 抛出异常:TypeError:null不是对象(评估 'RNGoogleSignin.SIGN_IN_CANCELLED')
【问题讨论】:
【参考方案1】:请运行 pod-install 并在 pod install 上确认
Installing FirebaseAuth (8.1.0)
Installing FirebaseInstallations (8.1.0)
Installing FirebaseMessaging (8.1.0)
Installing GTMAppAuth (1.2.2)
Installing GTMSessionFetcher (1.5.0)
Installing GoogleSignIn (5.0.2)
Installing GoogleUtilities 7.4.1
Installing RNFBAuth (12.1.0)
Installing RNFBMessaging (12.1.0)
Installing **RNGoogleSignin** (6.0.0)
【讨论】:
以上是关于@react-native-google-signin/google-signin/src/GoogleSignin.js 抛出异常 null is not an object(评估'RNGoogle的主要内容,如果未能解决你的问题,请参考以下文章