-
Notifications
You must be signed in to change notification settings - Fork 813
Closed
Description
I cant set a new custom icon. I'm not so familier with HOC and how to use it.
I tried to call and but both gave me same error.
everything else works fine if i remove the custom icons.
what did i miss?!
This is the error i get!
Line 46: 'google' is not defined no-undef
Line 47: 'google' is not defined no-undef
Here is my code!
import React, { Component } from 'react';
import {Map, InfoWindow, Marker, GoogleApiWrapper} from 'google-maps-react';
export class MapContainer extends Component {
constructor(props) {
super(props);
this.onMarkerClick = this.onMarkerClick.bind(this);
this.state = {
showingInfoWindow: false,
activeMarker: {},
selectedPlace: {},
}
}
onMarkerClick(props, marker, e) {
this.setState({
selectedPlace: props,
activeMarker: marker,
showingInfoWindow: true
});
}
render() {
return (
<Map google={this.props.google} zoom={14}>
<Marker onClick={this.onMarkerClick}
icon={{
url: "/img/icon.svg",
anchor: new google.maps.Point(32,32),
scaledSize: new google.maps.Size(64,64)
}}
name={'Current location'} />
<InfoWindow
marker={this.state.activeMarker}
visible={this.state.showingInfoWindow}>
<div>
<h1>{this.state.selectedPlace.name}</h1>
</div>
</InfoWindow>
</Map>
);
}
}
export default GoogleApiWrapper({
apiKey: ('A***********')
})(MapContainer)
programmer1402, BaronMatrai, dienamo and ImanYZ
Metadata
Metadata
Assignees
Labels
No labels