From 04237e4aa9955e0b1a3c326ed8742531700ecace Mon Sep 17 00:00:00 2001 From: Binur Konarbai Date: Fri, 4 Nov 2016 21:18:57 +0600 Subject: [PATCH] Add mapMarkerUrl prop to use custom markers The linked marker must be at most 64x64 --- GoogleStaticMap.js | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/GoogleStaticMap.js b/GoogleStaticMap.js index 062955a..d058d3b 100644 --- a/GoogleStaticMap.js +++ b/GoogleStaticMap.js @@ -109,7 +109,12 @@ class GoogleStaticMap extends Component { /** * Add a marker on the center */ - hasCenterMarker: React.PropTypes.bool + hasCenterMarker: React.PropTypes.bool, + + /** + * Marker's icon url, max 64x64 + */ + markerUrl: React.PropTypes.string, }; static defaultProps = { @@ -149,10 +154,14 @@ class GoogleStaticMap extends Component { const { latitude, longitude, - hasCenterMarker + hasCenterMarker, + markerUrl } = this.props; - const markerParams = `markers=${latitude},${longitude}`; + const markerParams = !!markerUrl + ? `markers=icon:${markerUrl}%7Cshadow:true%7C${latitude},${longitude}` + : `${latitude},${longitude}`; + return hasCenterMarker ? markerParams : ''; }