Google-signin: this._removeListeners is undefined in GoogleSignin.android.js

Created on 16 Aug 2016  路  7Comments  路  Source: react-native-google-signin/google-signin

Hi all,

I'm getting the error "Possible Unhandled Promise Rejection" in line 112 of GoogleSignin.android.js.

Debugging I could see that the login was OK, but the function this._removeListeners is undefined.
Anyone has the same error?

Thanks!

Most helpful comment

Thanks for the quick reply @farazs
The problem for me was the following though: If you are using this with redux-saga then you have to call all the API methods like this

yield call([GoogleSignin, GoogleSignin.currentUserAsync])

so that the this reference is bound to GoogleSignin

All 7 comments

Hi all!

I've tried to call const { GoogleSignin } = 'react-native-google-signin' inside my method and things got OK, before I was loading GoogleSignin on top of my file, as usual.

Would be better adjust the module to suport creation on top of the file, just like the other modules.

I'll try do some changes to this get working and after everything ok here I would PR for your validation.

Thanks!

EDIT...
It's not working...
I've changed this
this._removeListeners(sucessCb, errorCb);

to this
sucessCb.remove(); errorCb.remove();

I'm runing on
Node
Version: v6.3.1
NPM
Version: 3.10.3
React Native CLI
Version: 1.0.0
App
React Native Version: 0.30.0

Any reason why this was closed? I'm having the same issue. Not sure why others are not.

Same issue for me too

It seems calling it like
GoogleSignin.configure(...).then(GoogleSignin.signIn) causes the issue.

I fixed by changing to GoogleSignin.configure(...).then(() => { return GoogleSignin.signIn() }). Not exactly sure why that works.

Thanks for the quick reply @farazs
The problem for me was the following though: If you are using this with redux-saga then you have to call all the API methods like this

yield call([GoogleSignin, GoogleSignin.currentUserAsync])

so that the this reference is bound to GoogleSignin

I had a similar issue as I'm moving to Sagas and I resolved it in a similar way; I used the apply function from Sagas.

The problem is...after resolving the remove listeners thing, I'm now getting (node:9622) [DEP0016] DeprecationWarning: 'root' is deprecated, use 'global'

I'm trying to figure out if it's GoogleSignin or not

Here's how I did it:

import { GoogleSignin, statusCodes } from '@react-native-community/google-signin';

const { idToken } = yield call(GoogleSignin.signIn);
Was this page helpful?
0 / 5 - 0 ratings