Skip to content

Commit

Permalink
fix(OverlayView): add invariant checking for position props
Browse files Browse the repository at this point in the history
  • Loading branch information
tomchentw committed Aug 18, 2015
1 parent 1fc968a commit 757bda0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
},
"dependencies": {
"google-maps-infobox": "^1.1.13",
"invariant": "^2.1.0",
"react": "^0.13.0"
},
"peerDependencies": {
Expand Down
3 changes: 3 additions & 0 deletions src/creators/OverlayViewCreator.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
Component,
Children,
} from "react";
import {default as invariant} from "invariant";

import {default as defaultPropsCreator} from "../utils/defaultPropsCreator";
import {default as composeOptions} from "../utils/composeOptions";
Expand Down Expand Up @@ -100,6 +101,8 @@ export default class OverlayViewCreator extends Component {
overlayView._getPixelPosition = function () {
let projection = this.getProjection();
let position = this.get("position");
invariant(!!position, "OverlayView requires a position/defaultPosition in your props instead of %s", position);

if (projection && position) {
if (!(position instanceof google.maps.LatLng)) {
position = new google.maps.LatLng(position.lat, position.lng);
Expand Down

0 comments on commit 757bda0

Please sign in to comment.