Skip to content

Commit

Permalink
fix(OverlayView): props.{default}mapPaneName should not be required
Browse files Browse the repository at this point in the history
* also fix options resolution by using composeOptions
  • Loading branch information
tomchentw committed Aug 8, 2015
1 parent 0061d48 commit 702a571
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/creators/OverlayViewCreator.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@ import {
} from "react";

import {default as defaultPropsCreator} from "../utils/defaultPropsCreator";
import {default as composeOptions} from "../utils/composeOptions";

import {default as GoogleMapHolder} from "./GoogleMapHolder";

export const overlayViewControlledPropTypes = {
// CustomProps
mapPaneName: PropTypes.string.isRequired,
mapPaneName: PropTypes.string,
getPixelPositionOffset: PropTypes.func,
// [].map.call($0.querySelectorAll("tr>td>code"), function(it){ return it.textContent; }).filter(function(it){ return it.match(/^set/) && !it.match(/^setMap/); })
// https://developers.google.com/maps/documentation/javascript/3.exp/reference
Expand All @@ -29,7 +30,11 @@ export default class OverlayViewCreator extends Component {
static _createOverlayView (mapHolderRef, overlayViewProps) {
// https://developers.google.com/maps/documentation/javascript/3.exp/reference#OverlayView
const overlayView = new google.maps.OverlayView();
overlayView.setValues(overlayViewProps);
overlayView.setValues(composeOptions(overlayViewProps, [
"mapPaneName",
"getPixelPositionOffset",
"children",
]));

overlayView.onAdd = function () {
this._containerElement = document.createElement("div");
Expand Down

3 comments on commit 702a571

@ksavenkov
Copy link

Choose a reason for hiding this comment

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

@tomchentw something broke after this commit. In my app OverlayView started to behave as all its options are default (uncontrolled). The problem is that position should be controlled in my case.

@ksavenkov
Copy link

Choose a reason for hiding this comment

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

Ah, sorry, as I understand position now should move into options prop. That solved the issue.

@tomchentw
Copy link
Owner Author

Choose a reason for hiding this comment

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

👍

Please sign in to comment.