Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Hide default fullscreen button on react-google-maps

I have a problem with react-google-maps.

I created my own button for FullScreen toggle

enter image description here

I have tried but can't find the way to get rid of the default button. I tried to add this to my code, but it didn't work.

<GoogleMap
 ref={(map) => console.log()}
 defaultZoom={12}
 defaultCenter={{ lat: this.state.lat, lng: this.state.lng }}
 fullscreenControl={false}
>

Any help will be appreciated.

Cheers!

like image 209
0sserc Avatar asked Aug 15 '17 10:08

0sserc


2 Answers

I think library got an update: google-map-react 0.23

defaultOptions changed to options

const mapOptions = {
  fullscreenControl: false,
};

const Map = withGoogleMap(props=>(
  <GoogleMap
    defaultZoom={12}
    defaultCenter={{ lat: this.state.lat, lng: this.state.lng }}
    options={mapOptions}
  />
))

Hope it helps

like image 119
Gerardo BLANCO Avatar answered Oct 22 '22 00:10

Gerardo BLANCO


Just to include it in default options

const defaultMapOptions = {
  fullscreenControl: false,
};

const InputGoogleMap = withGoogleMap(props=>(
  <GoogleMap
    ref={(map) => console.log()}
    defaultZoom={12}
    defaultCenter={{ lat: this.state.lat, lng: this.state.lng }}
    defaultOptions={defaultMapOptions}
  />
))

For more Google Maps options you can find it here: https://developers.google.com/maps/documentation/javascript/reference?csw=1#MapOptions

like image 45
Khue Pham Avatar answered Oct 22 '22 00:10

Khue Pham