question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Property "optimized" is not working on Marker component

See original GitHub issue

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.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
btouegcommented, Dec 8, 2017

@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,
}
0reactions
techboy-zerocommented, Dec 10, 2017

Thanks a lot! Now it works as expected.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Marker | Maps JavaScript API - Google Developers
Optimization enhances performance by rendering many markers as a single static element. This is useful in cases where a large number of markers...
Read more >
Google Maps Unoptimized Marker / fitBounds - Stack Overflow
I have come across an issue wherein calling google.maps.Map.fitBounds() causes markers to be removed from the DOM when un-optimized markers are ...
Read more >
Optimize React Native Map in Your Applications [A How To ...
1. Turn off trackViewChanges in custom Markers when not needed · 2. React.memo, or shouldComponentUpdate, or PureComponent · 3. Use “icon” instead ...
Read more >
Introduction to React Native Maps - LogRocket Blog
In this guide, we'll demonstrate how to integrate Google Maps into your React Native application and introduce you to fundamental components ...
Read more >
Working With the Map Component - Jaspersoft Community
If you are using the default marker, you can set additional properties, such as color, label, etc. These properties are not available for...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found