Skip to content

Commit

Permalink
fix(InfoWindow): allow children to receive React's context
Browse files Browse the repository at this point in the history
  • Loading branch information
benwiley4000 committed Oct 14, 2016
1 parent e8e3eed commit ca73c85
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions src/lib/InfoWindow.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
} from "react";

import {
render,
unstable_renderSubtreeIntoContainer,
unmountComponentAtNode,
} from "react-dom";

Expand Down Expand Up @@ -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); },
Expand Down Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion src/lib/enhanceElement.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit ca73c85

Please sign in to comment.