Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting TypeError: Cannot read property 'addEventListener' of undefined #360

Closed
prewk opened this issue Oct 11, 2016 · 5 comments
Closed

Comments

@prewk
Copy link

prewk commented Oct 11, 2016

Hi, I'm using ScriptjsLoader to load the map. When loading the map it seems to work at first, but when the component gets dismounted (I navigate to another page in our SPA) and go back again I get this error from within the minified Google Maps API JS: TypeError: Cannot read property 'addEventListener' of undefined

screen shot 2016-10-11 at 16 25 57

Important disclaimer: We're not currently rendering the maps correctly at all because of API key problems we're working out with Google. I would however love to know if this is a problem entirely caused by missing API keys or if something else obvious is amiss.

Thanks!

@tomchentw
Copy link
Owner

missing API keys is pretty annoying stuff, and it may cause map not rendering. Please try to fix it.

Also, we're releasing 6.0.0 now. Please try to upgrade because there are various bugs in <6.0.0 and we won't fix them. See #318

@prewk
Copy link
Author

prewk commented Oct 11, 2016

Oh, I wasn't aware that we were so far behind with the versions. I'll try v6 and get back to you.

@prewk prewk closed this as completed Oct 11, 2016
@tomchentw
Copy link
Owner

It's still in the beta channel btw. Also, check out the changelog file. Let me know if you have any questions.

@prewk
Copy link
Author

prewk commented Oct 11, 2016

It solved my problem. Thanks!

I think you should look over this async part in the readme. I think GettingStartedGoogleMap is supposed to be AsyncGettingStartedExampleGoogleMap, and the imports weren't obvious to figure out so might as well include them:

import withGoogleMap from 'react-google-maps/lib/withGoogleMap';
import withScriptjs from 'react-google-maps/lib/async/withScriptjs';

@tomchentw
Copy link
Owner

@prewk Good catch! I'll update the README. Thanks a lot

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants