Skip to content

Commit

Permalink
fix(Marker): remove buggy MarkerWithLabel support
Browse files Browse the repository at this point in the history
BREAKING CHANGE: MarkerWithLabel comes with its own React Component now

Before:

```js
import { Marker } from "react-google-maps";

<Marker
  position={{ lat: -34.397, lng: 150.644 }}
  labelAnchor={new google.maps.Point(0, 0)}
  labelContent="<div>Hello There!</div>"
  labelStyle={{/* WON'T WORK */}}
/>
```

After:

```js
import MarkerWithLabel from "react-google-maps/lib/components/addons/MarkerWithLabel";

<MarkerWithLabel
  position={{ lat: -34.397, lng: 150.644 }}
  labelAnchor={new google.maps.Point(0, 0)}
  labelStyle={{backgroundColor: "yellow", fontSize: "32px", padding: "16px"}}
>
  <div>Hello There!</div>
</MarkerWithLabel>
```
  • Loading branch information
Daghan Gunay authored and tomchentw committed Oct 16, 2017
1 parent 3f7670f commit b3985f4
Showing 1 changed file with 2 additions and 35 deletions.
37 changes: 2 additions & 35 deletions src/macros/Marker.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,31 +36,6 @@ export class Marker extends React.PureComponent {
* @see https://github.com/mikesaidani/marker-clusterer-plus
*/
noRedraw: PropTypes.bool,
/**
* For `MarkerWithLabel`
* @see https://cdn.rawgit.com/googlemaps/v3-utility-library/master/markerwithlabel/src/markerwithlabel.js
*/
markerWithLabel: PropTypes.func,
/**
* For `MarkerWithLabel`
* @see https://cdn.rawgit.com/googlemaps/v3-utility-library/master/markerwithlabel/src/markerwithlabel.js
*/
labelClass: PropTypes.string,
/**
* For `MarkerWithLabel`
* @see https://cdn.rawgit.com/googlemaps/v3-utility-library/master/markerwithlabel/src/markerwithlabel.js
*/
labelAnchor: PropTypes.object,
/**
* For `MarkerWithLabel`
* @see https://cdn.rawgit.com/googlemaps/v3-utility-library/master/markerwithlabel/src/markerwithlabel.js
*/
labelContent: PropTypes.string,
/**
* For `MarkerWithLabel`
* @see https://cdn.rawgit.com/googlemaps/v3-utility-library/master/markerwithlabel/src/markerwithlabel.js
*/
labelStyle: PropTypes.object,
}

static contextTypes = {
Expand All @@ -77,8 +52,7 @@ export class Marker extends React.PureComponent {
*/
constructor(props, context) {
super(props, context)
const GMKlass = this.props.markerWithLabel || google.maps.Marker
const marker = new GMKlass()
const marker = new google.maps.Marker()
construct(Marker.propTypes, updaterMap, this.props, marker)
const markerClusterer = this.context[MARKER_CLUSTERER]
if (markerClusterer) {
Expand Down Expand Up @@ -133,11 +107,4 @@ export default Marker

const eventMap = {}

const updaterMap = {
/*
* @see https://github.com/printercu/google-maps-utility-library-v3-read-only/blob/master/markerwithlabel/src/markerwithlabel.js
*/
labelContent(instance, labelContent) {
instance.set(`labelContent`, labelContent)
},
}
const updaterMap = {}

0 comments on commit b3985f4

Please sign in to comment.