New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changing the position of controls makes them disappear #6
Comments
Thank you. As there are a lot of google constants can be used in options i know this constants (but i don't know all) google.maps.ControlPosition
google.maps.MapTypeControlStyle
google.maps.ZoomControlStyle
google.maps.MapTypeId It's better to add something like import GoogleMap from 'google-map-react';
import OfficeMarker from './markers/OfficeMarker';
function mapOptionsCreator(map) {
return {
scrollwheel: false,
zoomControlOptions: {
position: map.ControlPosition.RIGHT_CENTER, // as long as this is not set it works
style: map.ZoomControlStyle.SMALL
},
mapTypeControlOptions: {
position: map.ControlPosition.BOTTOM_RIGHT // this makes the map type control disappear
},
draggable: false,
rotateControl: false,
scaleControl: false,
streetViewControl: false,
panControl: false,
};
}
const Map = React.createClass({
render() {
return (
<div className="map-container" style={{height: '400px'}}>
<GoogleMap
options={mapOptionsCreator}
center={this.props.center}
zoom={this.props.zoom}>
<OfficeMarker lat={this.props.officeCoords.lat} lng={this.props.officeCoords.lng} />
</GoogleMap>
</div>
);
}); And if This is the first exception to my rule - Don't expose google api I start to add this right now. |
Done, example |
Perfect! thank you for fixing that so fast :) |
Hi,i am having same issue with Map component.Not able to change maptypecontrol options. <Map
|
Hi @vidyaramachandran56, did you figure it out ? I am not able to use mapTypeControl either. They render for a micro second and it disappears quickly after. Even though i am adding this to the options
|
@abidRahim ,the issue is resolved.Since I was using google-maps library ,I couldn't change the type control style and position. |
Thanks. It just worked for me. I was working under Development Mode , with no key . As soon as i added the key it worked for me. |
I have a similar problem. Are you using a Development mode key or Production mode key? |
Is this working in the Curren release. I cannot get it working
|
How to enable TIlt & Rotate Control with React Google Map API |
If I set the position in either zoomControlOptions or mapTypeControlOptions, which is passed to the GoogleMap component in through the options prop, they disappear. When the attribute is not set they render fine to their default positions.
I've followed followed the control position class documentation, using values like: 'BOTTOM_RIGHT', 'TOP_RIGHT', and 'LEFT_CENTER', none of which work.
https://developers.google.com/maps/documentation/javascript/reference#ControlPosition
This is how I'm using it:
The text was updated successfully, but these errors were encountered: