From 27e6675d26522f5ecbb49fef07374e320b37f3a1 Mon Sep 17 00:00:00 2001 From: orangemug Date: Sun, 19 Jan 2020 16:30:27 +0000 Subject: [PATCH] Fix replacing of access tokens in MapboxGl. --- src/components/map/MapboxGlMap.jsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/components/map/MapboxGlMap.jsx b/src/components/map/MapboxGlMap.jsx index bd9e476..d677212 100644 --- a/src/components/map/MapboxGlMap.jsx +++ b/src/components/map/MapboxGlMap.jsx @@ -60,6 +60,7 @@ export default class MapboxGlMap extends React.Component { inspectModeEnabled: PropTypes.bool.isRequired, highlightedLayer: PropTypes.object, options: PropTypes.object, + replaceAccessTokens: PropTypes.func.isRequired, onChange: PropTypes.func.isRequired, } @@ -90,7 +91,10 @@ export default class MapboxGlMap extends React.Component { //Mapbox GL now does diffing natively so we don't need to calculate //the necessary operations ourselves! - this.state.map.setStyle(props.mapStyle, {diff: true}) + this.state.map.setStyle( + this.props.replaceAccessTokens(props.mapStyle), + {diff: true} + ) } componentDidUpdate(prevProps) {