I'm using react-google-maps/api node module. I need to set the value of zoomControlOptions is TOP_LEFT but I ended up getting this error Uncaught ReferenceError: google is not defined. Here is the link to the repo.
I'm getting the error here
const options = {
zoomControl: true,
mapTypeControl: false,
minZoom: 2,
streetViewControl: false,
zoomControlOptions: {
position: google.maps.ControlPosition.TOP_LEFT, // google is undefined here
},
};
Please help me :)
Try to define "options" inside your component and add "window", like
position: window.google.maps.ControlPosition.TOP_LEFT
Also, you can put just a number
BOTTOM: 11
BOTTOM_CENTER: 11
BOTTOM_LEFT: 10
BOTTOM_RIGHT: 12
CENTER: 13
LEFT: 5
LEFT_BOTTOM: 6
LEFT_CENTER: 4
LEFT_TOP: 5
RIGHT: 7
RIGHT_BOTTOM: 9
RIGHT_CENTER: 8
RIGHT_TOP: 7
TOP: 2
TOP_CENTER: 2
TOP_LEFT: 1
TOP_RIGHT: 3