Skip to content

Commit ca73c85

Browse files
committed
fix(InfoWindow): allow children to receive React's context
1 parent e8e3eed commit ca73c85

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/lib/InfoWindow.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import {
1010
} from "react";
1111

1212
import {
13-
render,
13+
unstable_renderSubtreeIntoContainer,
1414
unmountComponentAtNode,
1515
} from "react-dom";
1616

@@ -71,8 +71,8 @@ const publicMethodMap = {
7171
};
7272

7373
const controlledPropUpdaterMap = {
74-
children(infoWindow, children) {
75-
render(Children.only(children), infoWindow.getContent());
74+
children(infoWindow, children, component) {
75+
unstable_renderSubtreeIntoContainer(component, Children.only(children), infoWindow.getContent());
7676
},
7777
options(infoWindow, options) { infoWindow.setOptions(options); },
7878
position(infoWindow, position) { infoWindow.setPosition(position); },
@@ -135,7 +135,7 @@ export default _.flowRight(
135135

136136
componentDidMount() {
137137
const infoWindow = getInstanceFromComponent(this);
138-
controlledPropUpdaterMap.children(infoWindow, this.props.children);
138+
controlledPropUpdaterMap.children(infoWindow, this.props.children, this);
139139
},
140140

141141
componentWillReceiveProps(nextProps, nextContext) {

src/lib/enhanceElement.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ const enhanceWithPropTypes = _.curry((
8787
_.forEach(controlledPropUpdaterMap, (fn, key) => {
8888
const nextValue = this.props[key];
8989
if (nextValue !== prevProps[key]) {
90-
fn(getInstanceFromComponent(this), nextValue);
90+
fn(getInstanceFromComponent(this), nextValue, this);
9191
}
9292
});
9393
componentDidUpdate.call(this, prevProps, prevState);

0 commit comments

Comments
 (0)