Changing the position of controls makes them disappear
See original GitHub issueIf 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:
import GoogleMap from 'google-map-react';
import OfficeMarker from './markers/OfficeMarker';
let mapOptions = {
scrollwheel: false,
zoomControlOptions: {
// position: 'RIGHT_CENTER', // as long as this is not set it works
style: 'SMALL'
},
mapTypeControlOptions: {
position: '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={mapOptions}
center={this.props.center}
zoom={this.props.zoom}>
<OfficeMarker lat={this.props.officeCoords.lat} lng={this.props.officeCoords.lng} />
</GoogleMap>
</div>
);
});
Issue Analytics
- State:
- Created 8 years ago
- Comments:9
Top Results From Across the Web
Missing Effect Controls Panel and No Toolbar Fix - YouTube
A tutorial on how to to fix no effect controls and a missing toolbar in Premiere Pro CC. I also demonstrate how to...
Read more >About content controls - Microsoft Support
Content controls can provide instructional text for users, and you can set controls to disappear when users type in their own text.
Read more >Edit Control Center on your iPhone, iPad, and iPod touch
How to rearrange a control. Go to Settings > Control Center. Touch and hold the Reorder button and move the controls in the...
Read more >Positioning - Learn web development | MDN
To make a specific type of positioning active on an element, ... its final position, including making it overlap other elements on the...
Read more >Controls | Maps JavaScript API - Google Developers
By default, all the controls disappear if the map is too small (200x200px). ... You can set control options to change the default...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
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
Thank you.
GMAP API
uses it’s internal constants to set view options, likegoogle.maps.ZoomControlStyle.SMALL
. And it’s my big fault that i don’t expose this constants to user.As there are a lot of google constants can be used in options i know this constants (but i don’t know all)
It’s better to add something like
optionsCreator
initialization.And if
options
prop is function, i call it with google.map variable.This is the first exception to my rule - Don’t expose google api
I start to add this right now.