react-google-maps icon indicating copy to clipboard operation
react-google-maps copied to clipboard

Property "optimized" is not working on Marker component

Open techie014 opened this issue 8 years ago • 6 comments

Using react-google-maps version 4.11.0.

I am trying get a specific marker rendered as image and also apply z-index on it. But somehow it is not happening.

  • Property Object:
myLocationMarker: {
  position: {
    lat: anyValidLatitude,
    lng: anyValidLongitude,
  },
  title: 'Your Location',
  icon: '/path/to/image.imageFormat',
  defaultAnimation: 2,
  optimized: false,
  zIndex: 1000,
}
  • Marker:
<Marker {...myLocationMarker} />

The marker is getting rendered on map without any error. But not as an individual image.

Please, let me know if it is possible and also the proper way to do it. Any kind of workaround is appreciated.

techie014 avatar Dec 04 '17 14:12 techie014

Maybe you need an upgrade of react-google-maps. But the latest Marker doesn't have the property of optimized as well: https://tomchentw.github.io/react-google-maps/#!/Marker

tomchentw avatar Dec 06 '17 01:12 tomchentw

Thanks for your response. But right now I cannot upgrade to latest version. Will have problem with current import paths used in project. Also, if Marker does not have that property, upgrading won't help me anyway. But can you tell me any workaround? I need to put a marker which will be rendered as image so that I can apply z-index and stop other elements to cover it.

techie014 avatar Dec 06 '17 03:12 techie014

Sorry, I don't know if there's a workaround. Please ask about on Stack Overflow or Gitter.

tomchentw avatar Dec 06 '17 03:12 tomchentw

@techboy-zero here is how you should do it:

myLocationMarker: {
  position: {
    lat: anyValidLatitude,
    lng: anyValidLongitude,
  },
  title: 'Your Location',
  icon: '/path/to/image.imageFormat',
  defaultAnimation: 2,
  defaultOptions: {
    optimized: false,
  }
  zIndex: 1000,
}

btoueg avatar Dec 08 '17 14:12 btoueg

Thanks!

tomchentw avatar Dec 09 '17 07:12 tomchentw

Thanks a lot! Now it works as expected.

techie014 avatar Dec 10 '17 07:12 techie014