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

bundle.js:41862 Uncaught TypeError: Cannot read property 'Map' of undefined #54

Closed
pedroresende opened this issue Aug 30, 2016 · 5 comments

Comments

@pedroresende
Copy link

My component is the following

import React from 'react';
import {render} from 'react-dom';
import {Router, Route, IndexRoute, Link, hashHistory} from 'react-router';
import {Gmaps, Marker, InfoWindow, Circle} from 'react-gmaps';
require('../../../../../secrets.js');

var val = false;
var arrayMapsPoints = [];

var coords = {
    lat: 51.5258541,
    lng: -0.08040660000006028
};

var MapDropdown = React.createClass({
    onMapCreated(map2) {
        map2.setOptions({disableDefaultUI: true});
    },

    onDragEnd(e) {
        console.log('onDragEnd', e);
    },

    onCloseClick() {
        console.log('onCloseClick');
    },

    onClick(e) {
        console.log('onClick', e);
    },
    render() {
        return (
            <div>
                {coords.lat}
                <Gmaps width={'800px'} height={'600px'} lat={coords.lat} lng={coords.lng} zoom={12} loadingMessage={'Be happy'} params={{
                    v: '3.exp',
                    key: google.key
                }} onMapCreated={this.onMapCreated}></Gmaps>

            </div>
        )
    }

});

export default MapDropdown;
@MicheleBertoli
Copy link
Owner

hello @pedroresende

the line that should have given you the error is the following:
this.map = new google.maps.Map

which means that for some reason the maps property of the google object does not exist when the callback gets fired (which is really weird).

I've got some questions for you in order to find the problem:

  • which version of the library are you using?
  • do you have multiple maps on a single page?
  • if you open the DevTools, can you see any error related to the Google Maps SDK?

@pedroresende
Copy link
Author

Hi @MicheleBertoli,

I've installed using npm, I suppose the installed version is 1.5.0, yes I have multiple maps on the same page, however the other one was mounted using the default google api. About the DevTools, I don't see any error related with Google Maps SDK.

Do you think it is related with multiple maps on the same page, even though not being on the same container ?

@MicheleBertoli
Copy link
Owner

can you try removing the other map and see if it works @pedroresende? thanks!

@pedroresende
Copy link
Author

@MicheleBertoli The problem remains the same

@MicheleBertoli
Copy link
Owner

MicheleBertoli commented Sep 6, 2016

oh, that's interesting @pedroresende
it there a way for you to provide me the failing code?
the code from your first comment is working for me unfortunately.
thanks!

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