Skip to content

Conversation

@rideyourstyle
Copy link

I replaced react-google-maps and added mapOptions, used by the new library

@rameshsyn
Copy link
Owner

@rideyourstyle Nice work! will review changes and merge. Thanks.

@asimkt
Copy link

asimkt commented Jul 19, 2020

@rameshsyn got a chance to review this? I'm getting a

index.js:183 Uncaught TypeError: Cannot read property 'maps' of undefined

at

key: 'geocodePosition',
    value: function geocodePosition(position) {
      // Geocoder instance
      var geocoder = new google.maps.Geocoder();
      return new Promise(function (resolve, reject) {
        geocoder.geocode({
          location: position
        }, function (results, status) {
          if (status === google.maps.GeocoderStatus.OK) {
            resolve(results);
          } else {
            reject(status);
          }
        });
      });
    }

Will this error be fixed by this change?

@rameshsyn
Copy link
Owner

@asimkt This change is about replacing the internal library.

@rameshsyn
Copy link
Owner

@asimkt Can you confirm that you included <script src="https://maps.googleapis.com/maps/api/js?key={YOUR_API_KEY}&v=3.exp&libraries=geometry,drawing,places"></script>?

@asimkt
Copy link

asimkt commented Jul 19, 2020

@asimkt Can you confirm that you included <script src="https://maps.googleapis.com/maps/api/js?key={YOUR_API_KEY}&v=3.exp&libraries=geometry,drawing,places"></script>?

I did inside an effect. So the flow is like:

  1. Include script
  2. on script load, change a state, render the picker.

This is working fine. I'm getting map and all, but when I change the location, the mentioned error occurs. I couldn't find a fix, so went with another library for now. I will try to create a code sandbox, but not sure.

@rideyourstyle
Copy link
Author

Have you tried include it outside of the effect?

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

Successfully merging this pull request may close these issues.

3 participants