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

Remove react-google-maps dependency #1389

Merged
merged 6 commits into from
Dec 15, 2020
Merged

Remove react-google-maps dependency #1389

merged 6 commits into from
Dec 15, 2020

Conversation

Gnito
Copy link
Contributor

@Gnito Gnito commented Dec 8, 2020

react-google-maps library has been unmaintained for 3 years.

Google Maps integration will be operated without any react wrapper library from now on.
We just need a couple of classes from Google Maps API:

  • OverlayView (This is needed to render HTML on top of the map.)
  • Marker or
  • "Circle" for fuzzy coordinates (I actually ended up using Polygon to improve roundness)

OverlayView is definitely the most complex setup. Luckily, part of the work to support it without react-google-maps was already done with some old bug fixes that were made on top of react-google-maps and generalization made to support Mapbox.

Other notes:

  • Renaming: SearchMapWithGoogleMap => SearchMapWithGoogleMaps
  • The default map provider is still Mapbox.

@Gnito Gnito force-pushed the remove-react-google-maps branch 4 times, most recently from c3dcd85 to ee258b9 Compare December 14, 2020 11:00
Copy link
Contributor

@kpuputti kpuputti left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will submit this partial review already now for you to read. I still have to review the largest file.

CHANGELOG.md Outdated Show resolved Hide resolved
src/components/Map/DynamicGoogleMap.js Outdated Show resolved Hide resolved
src/components/SearchMap/SearchMap.js Show resolved Hide resolved
src/components/SearchMap/SearchMap.js Show resolved Hide resolved
src/util/googleMaps.js Show resolved Hide resolved
src/components/SearchMap/SearchMapWithGoogleMaps.js Outdated Show resolved Hide resolved
src/components/SearchMap/SearchMapWithGoogleMaps.js Outdated Show resolved Hide resolved
src/components/SearchMap/SearchMapWithGoogleMaps.js Outdated Show resolved Hide resolved
src/components/SearchMap/SearchMapWithGoogleMaps.js Outdated Show resolved Hide resolved
{...rest}
/>
<div
id="map"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is a bit too prone to conflict. If the id is really required, could it come as a prop from the page?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd keep the id because Google Maps is quite difficult to debug without some document.getElementById() calls from DevTools. (The element on those map panes are not selectable by right-clicking on top of the map.)

Anyway, I passed the id ("searchMap") from SearchMap component, but I didn't push it further than that. (And anyway, it's unlikely that there's more than one SearchMap instance since it takes 2/5 of the entire screen.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it is unlikely that a page in the app will have multiple search maps. However, we do have plans to use the styleguide more for lots of things like map variants etc., so it would be helpful to be able to define unique IDs there.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Showing these components, that take the entire-screen into use, needs some thinking. However, the change I made now should allow different ids to be passed for the SearchMap component.

src/components/SearchMap/SearchMapWithGoogleMaps.js Outdated Show resolved Hide resolved
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.

2 participants