Property "optimized" is not working on Marker component
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.
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
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.
Sorry, I don't know if there's a workaround. Please ask about on Stack Overflow or Gitter.
@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,
}
Thanks!
Thanks a lot! Now it works as expected.