Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix static context bug #749

Merged
merged 1 commit into from Mar 4, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
30 changes: 15 additions & 15 deletions src/components/static-map.js
Expand Up @@ -258,27 +258,27 @@ export default class StaticMap extends PureComponent<StaticMapProps, State> {
} = dimensions;
this._updateMapSize(width, height);

const staticContext = {
// $FlowFixMe
viewport: new WebMercatorViewport(Object.assign({}, this.props, this.props.viewState, {
width,
height
})),
map: this._map,
mapContainer: this._mapContainerRef.current
};

return createElement(MapContext.Consumer, null, interactiveContext =>
createElement(MapContext.Provider,
{value: Object.assign(staticContext, interactiveContext)},
return createElement(MapContext.Consumer, null, interactiveContext => {
const context = Object.assign({}, interactiveContext, {
// $FlowFixMe
viewport: new WebMercatorViewport(Object.assign({}, this.props, this.props.viewState, {
width,
height
})),
map: this._map,
mapContainer: interactiveContext.mapContainer || this._mapContainerRef.current
});

return createElement(MapContext.Provider,
{value: context},
createElement('div', {
key: 'map-overlays',
className: 'overlays',
style: CONTAINER_STYLE,
children: this.props.children
})
)
);
);
});
}

render() {
Expand Down