I am currently working on a google-maps project using google-maps-react and I have come across a problem. I am using props to get the values of my marker (lat, lng, marker icon) however I am having trouble changing the size of the marker. I am left with an enormous marker and not able to change this. I have tries to pass the size as a prop but without success.
Thank you in advance for any help.
Here is my code:
MAPS.JS
render() {
/*--- initial code that i passed into props*/
/*var icon = {
url: "https://loc8tor.co.uk/wp-content/uploads/2015/08/stencil.png", // url
scaledSize: new this.props.google.maps.Size(90, 42), // scaled size
*/
}
return (
<div className="map-container">
<Map
google={this.props.google}
className={"map"}
zoom={4}
initialCenter={this.props.center}
>
{this.props.places.map((place, i) => {
//pass an array of markers as a child to the GoogleMap component and map over them
return (
<Marker
onClick={this.onMarkerClick}
key={place.id}
place_={place}
position={{ lat: place.lat, lng: place.lng }}
icon={place.url}
//Size={place.scaledSize} : Not working
/>
);
})}
<InfoWindowEx
marker={this.state.activeMarker}
visible={this.state.showingInfoWindow}
>
<div>
<h3>{this.state.selectedPlace.name}</h3>
<button
type="button"
onClick={this.showDetails.bind(this, this.state.selectedPlace)}
>
Show details
</button>
</div>
</InfoWindowEx>
</Map>
</div>
);
INDEX.JS
import React from "react";
import ReactDOM from "react-dom";
import Map from "./Map";
import "./styles.css";
const data = [
{
name: "Hello",
title: "Sydney",
lat: -33.847927,
lng: 150.6517938,
id: 1,
color: "blue",
url: "https://loc8tor.co.uk/wp-content/uploads/2015/08/stencil.png",
// scaledSize: Size(90, 42), // scaled size - Not working//
},
{