Skip to content

Commit

Permalink
Fix static context bug (#749)
Browse files Browse the repository at this point in the history
  • Loading branch information
Pessimistress committed Mar 4, 2019
1 parent b451e57 commit 1ccdbf7
Showing 1 changed file with 15 additions and 15 deletions.
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

0 comments on commit 1ccdbf7

Please sign in to comment.