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 authored and Xiaoji Chen committed Mar 4, 2019
1 parent 014d1b1 commit 4b4cfb9
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions src/components/static-map.js
Expand Up @@ -257,26 +257,26 @@ 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
};

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
});

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 4b4cfb9

Please sign in to comment.