google-maps-react disabling scrollwheel

1.6k views Asked by At

is there a way to disable the scroll wheel? I'm not sure how to integrate this option into google-maps-react.

I tried this:

defaultOptions={{
    scrollwheel: false,
  }}

and this:

MAP_OPTIONS = {
  scrollwheel: false,
}

but it doesn't work for me

It would be awesome if you could help me! Thanks in advance!

2

There are 2 answers

0
Christopher Duris On

Can you provide the entire code please ?

Did you place it in the GoogleMap tag ?

<GoogleMap
  defaultOptions={{
    scrollwheel: false,
  }}
/>

It should work like this. Have a nice day,

0
Mikjail Salazar On

In https://github.com/fullstackreact/google-maps-react you have the chance to add the options as element properties.

According to https://developers.google.com/maps/documentation/javascript/interaction you can remove the scroll wheel by disabling "pan interactions" (gestureHandling: 'none')

solution:

<Map
  zoom={12}
  initialCenter={{ lat:-34.5920552, lng: -58.4253941 }}
  streetViewControl={false}
  fullscreenControl={false}
  gestureHandling='none' //this will disable scroll wheel
>
</Map>