From 81adb630641986999cee8ea00b3652d845e4da91 Mon Sep 17 00:00:00 2001 From: ztanner Date: Fri, 17 Mar 2017 10:16:24 -0700 Subject: [PATCH 1/2] fix(infoWindow): render children to react component --- src/lib/InfoWindow.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/lib/InfoWindow.js b/src/lib/InfoWindow.js index e8c8418a..35ee6648 100644 --- a/src/lib/InfoWindow.js +++ b/src/lib/InfoWindow.js @@ -12,6 +12,7 @@ import { import { unstable_renderSubtreeIntoContainer, unmountComponentAtNode, + render, } from "react-dom"; import { @@ -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, @@ -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, From 0581ed42c878c6d078564a9b0869779a52f62a27 Mon Sep 17 00:00:00 2001 From: ztanner Date: Fri, 17 Mar 2017 11:11:27 -0700 Subject: [PATCH 2/2] fix(infoWindow): fix warning --- src/lib/InfoWindow.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/lib/InfoWindow.js b/src/lib/InfoWindow.js index 35ee6648..12c3a68e 100644 --- a/src/lib/InfoWindow.js +++ b/src/lib/InfoWindow.js @@ -116,8 +116,6 @@ 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, @@ -126,7 +124,6 @@ export default _.flowRight( controlledPropTypes, this.props ), - content: div, // Override props of ReactElement type children: undefined, }); @@ -138,7 +135,12 @@ export default _.flowRight( }, componentDidMount() { + const div = document.createElement(`div`); + render(this.props.children, div); + const infoWindow = getInstanceFromComponent(this); + infoWindow.setContent(div); + controlledPropUpdaterMap.children(infoWindow, this.props.children, this); },