google-signin: undefined is not an object (evaluating 'RNGoogleSignin.BUTTON_SIZE_ICON')

I’ve just installed this library by running

npm install react-native-google-signin --save

I have the following at the top of my react script:

'use strict';
var React = require('react-native');
var {
  StyleSheet,
  Component,
  View,
  Text,
  TouchableOpacity,
  Navigator,
  TextInput
} = React;

and I then appended

import {GoogleSignin, GoogleSigninButton} from 'react-native-google-signin';

I then pressed Run in XCode and it throws the following error

undefined is not an object (evaluating ‘RNGoogleSignin.BUTTON_SIZE_ICON’)

If I remove

import {GoogleSignin, GoogleSigninButton} from 'react-native-google-signin';

the error is not thrown.

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 52 (2 by maintainers)

Most upvoted comments

I’m having this problem with Android. I have Google sign in working on iOS

Hi Guys… I was having the same issue which just got resolved. all you need to do is in the js files GoogleSignin.ios.js and GoogleSignin.android.js (located in node_modules/react-native-google-signin/src/) replace the below constants

GoogleSigninButton.Size = { Icon: RNGoogleSignin.BUTTON_SIZE_ICON, Standard: RNGoogleSignin.BUTTON_SIZE_STANDARD, Wide: RNGoogleSignin.BUTTON_SIZE_WIDE }; GoogleSigninButton.Color = { Auto: RNGoogleSignin.BUTTON_COLOR_AUTO, Light: RNGoogleSignin.BUTTON_COLOR_LIGHT, Dark: RNGoogleSignin.BUTTON_COLOR_DARK };

with

GoogleSigninButton.Size = { Icon: ‘48 x 48’, Standard: ‘230 x 48’, Wide: ‘312 x 48’ };

GoogleSigninButton.Color = { Auto: ‘white’, Light: ‘blue’, Dark: ‘grey’ };

Hello guys! I had that problem and it was because I didn’t initialise the project! Following the steps of this link I was able to solve the problem! https://github.com/devfd/react-native-google-signin/blob/master/ios-guide.md

Same issue in android… Issue might arise when you are messing with MainApplication.java or MainActivity.java

Solution in the above case: just unlink react-native-google-signin and link it again.

@SantoshShabadi your solution move me to a new error, help if you see this too? screen shot 2018-09-10 at 8 20 12 pm

@SantoshShabadi your solution works. Thanks

Same issue on Android developing on mac and on react-native 0.39.

Same Issue. Windows. Android

undefined is not an object (evaluating ‘RNGoogleSignin.BUTTON_SIZE_ICON’) getting on android on updation of React native 0.39… anyone can tell how to fix it

Facing the same issue for Android developing on Mac. Any update?

@andfs that’s what I figured. haven’t had a chance to update yet, but I’ll post here as well if that resolved the issue.

Annoying this was working for me at one point for Android and I’m now back to this issue again. Not sure how I fixed it the first time.