diff --git a/src/lib/InfoWindow.js b/src/lib/InfoWindow.js index 82dc732f..e8c8418a 100644 --- a/src/lib/InfoWindow.js +++ b/src/lib/InfoWindow.js @@ -10,7 +10,7 @@ import { } from "react"; import { - render, + unstable_renderSubtreeIntoContainer, unmountComponentAtNode, } from "react-dom"; @@ -71,8 +71,8 @@ const publicMethodMap = { }; const controlledPropUpdaterMap = { - children(infoWindow, children) { - render(Children.only(children), infoWindow.getContent()); + children(infoWindow, children, component) { + unstable_renderSubtreeIntoContainer(component, Children.only(children), infoWindow.getContent()); }, options(infoWindow, options) { infoWindow.setOptions(options); }, position(infoWindow, position) { infoWindow.setPosition(position); }, @@ -135,7 +135,7 @@ export default _.flowRight( componentDidMount() { const infoWindow = getInstanceFromComponent(this); - controlledPropUpdaterMap.children(infoWindow, this.props.children); + controlledPropUpdaterMap.children(infoWindow, this.props.children, this); }, componentWillReceiveProps(nextProps, nextContext) { diff --git a/src/lib/enhanceElement.js b/src/lib/enhanceElement.js index 2f7df240..99e696ff 100644 --- a/src/lib/enhanceElement.js +++ b/src/lib/enhanceElement.js @@ -87,7 +87,7 @@ const enhanceWithPropTypes = _.curry(( _.forEach(controlledPropUpdaterMap, (fn, key) => { const nextValue = this.props[key]; if (nextValue !== prevProps[key]) { - fn(getInstanceFromComponent(this), nextValue); + fn(getInstanceFromComponent(this), nextValue, this); } }); componentDidUpdate.call(this, prevProps, prevState);