{"action":"closed","issue":{"url":"https://api.github.com/repos/tomchentw/react-google-maps/issues/244","repository_url":"https://api.github.com/repos/tomchentw/react-google-maps","labels_url":"https://api.github.com/repos/tomchentw/react-google-maps/issues/244/labels{/name}","comments_url":"https://api.github.com/repos/tomchentw/react-google-maps/issues/244/comments","events_url":"https://api.github.com/repos/tomchentw/react-google-maps/issues/244/events","html_url":"https://github.com/tomchentw/react-google-maps/issues/244","id":151226496,"number":244,"title":"When modifying the map control position google is undefined","user":{"login":"carlosperalta88","id":447327,"avatar_url":"https://avatars.githubusercontent.com/u/447327?v=3","gravatar_id":"","url":"https://api.github.com/users/carlosperalta88","html_url":"https://github.com/carlosperalta88","followers_url":"https://api.github.com/users/carlosperalta88/followers","following_url":"https://api.github.com/users/carlosperalta88/following{/other_user}","gists_url":"https://api.github.com/users/carlosperalta88/gists{/gist_id}","starred_url":"https://api.github.com/users/carlosperalta88/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/carlosperalta88/subscriptions","organizations_url":"https://api.github.com/users/carlosperalta88/orgs","repos_url":"https://api.github.com/users/carlosperalta88/repos","events_url":"https://api.github.com/users/carlosperalta88/events{/privacy}","received_events_url":"https://api.github.com/users/carlosperalta88/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-04-26T20:04:51Z","updated_at":"2016-05-29T03:22:53Z","closed_at":"2016-05-29T03:22:53Z","body":"I have this component:\r\n\r\n```\r\nimport React, { Component } from 'react';\r\nimport { GoogleMap } from 'react-google-maps';\r\nimport { default as ScriptjsLoader } from 'react-google-maps/lib/async/ScriptjsLoader';\r\nimport { createHistory } from 'history';\r\n\r\nexport default class MapComponent extends Component {\r\n  state = {\r\n    mapLocation: {\r\n      position: { lat: -33.42794, lng: -70.60933 }\r\n    }\r\n  }\r\n\r\n  getCurrentUrl(currentLocation) {\r\n    return (currentLocation.substr(0, currentLocation.indexOf('/lat'))=='') ? currentLocation : currentLocation.substr(0, currentLocation.indexOf('/lat'))\r\n  }\r\n\r\n  handlePositionChanged() {\r\n    const history = createHistory()\r\n    const newPos = { lat: this.refs.googleMap.getCenter().lat(), lng: this.refs.googleMap.getCenter().lng() }\r\n    const currentUrl = this.getCurrentUrl(window.location.pathname)\r\n\r\n    console.log(this.refs.googleMap.getBounds().getNorthEast().lat());\r\n    console.log(this.refs.googleMap.getBounds().getNorthEast().lng());\r\n    history.replace(`${currentUrl}/lat=${newPos.lat},lng=${newPos.lng}`);\r\n  }\r\n\r\n  renderMap() {\r\n    const { position } = this.state.mapLocation;\r\n\r\n    return (<ScriptjsLoader\r\n      hostname={\"maps.googleapis.com\"}\r\n      pathname={\"/maps/api/js\"}\r\n      query={{ v: 3.23, libraries: 'geometry,drawing,places', key:'AIzaSyCd-29BjBduuKSRcDBtzyCvosvJl9TqfyU' }}\r\n      loadingElement={\r\n        <div>Loading</div>\r\n      }\r\n      containerElement={<div style={{ height: '100%' }} />}\r\n      googleMapElement={\r\n        <GoogleMap\r\n          ref={googleMap => {\r\n            if(!googleMap) return;\r\n            console.log(googleMap)\r\n          }}\r\n          defaultZoom={15}\r\n          defaultCenter={position}\r\n          defaultOptions={{ mapTypeControlOptions: { position: google.maps.ControlPosition.TOP_CENTER } }}\r\n          onDragend={::this.handlePositionChanged}\r\n        />\r\n      }\r\n            />\r\n            );\r\n  }\r\n\r\n  render() {\r\n    return this.renderMap();\r\n  }\r\n}\r\n```\r\n\r\nthe called for google.maps on defaultOptions is undefined. If is being loaded asynchronously why is this happening?  Thanks in advance"}}
{"actor":{"display_login":"tomchentw"}}