Skip to content

Commit

Permalink
fix(infoWindow): render children to react component
Browse files Browse the repository at this point in the history
  • Loading branch information
ztanner committed Mar 17, 2017
1 parent f1712f2 commit 81adb63
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/lib/InfoWindow.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
import {
unstable_renderSubtreeIntoContainer,
unmountComponentAtNode,
render,
} from "react-dom";

import {
Expand Down Expand Up @@ -115,6 +116,8 @@ export default _.flowRight(

getInitialState() {
const map = this.context[MAP];
const div = document.createElement(`div`);
render(this.props.children, div);
// https://developers.google.com/maps/documentation/javascript/3.exp/reference#InfoWindow
const infoWindow = new google.maps.InfoWindow({
map,
Expand All @@ -123,10 +126,11 @@ export default _.flowRight(
controlledPropTypes,
this.props
),
content: div,
// Override props of ReactElement type
content: document.createElement(`div`),
children: undefined,
});

openInfoWindow(this.context, infoWindow);
return {
[INFO_WINDOW]: infoWindow,
Expand Down

0 comments on commit 81adb63

Please sign in to comment.