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

Dynamically updating marker icon svg fill color

Open hanserino opened this issue 8 years ago • 4 comments

Hi,

I'm injecting some svg code inline to the icon prop on the Marker component. When I click it I want to highlight the marker by changing the fill color on the 's inside the . In the browser I can see that the component's icon svg code is updating, but visually it stays the same. Any ideas why?

Here's some of the code: (and yes, i'm updating the state on click, so it re-renders the component).

<Marker
    onClick={this.onMarkerClick.bind(this, item)}
    icon={`data:image/svg+xml;utf-8, <svg width="50" height="50" viewBox="0 0 100 100" version="1.1" xmlns="http://www.w3.org/2000/svg"><circle fill="${fillVariable}" opacity="0.25" cx="50%" cy="50%" r="${radiusVariable}"/></svg>`}
/>

hanserino avatar Nov 03 '16 15:11 hanserino

Hm... Not sure. Is this still an issue?

auser avatar Jul 25 '17 16:07 auser

@auser yes

click to place a marker, then click on marker should change it to blue

observe the console to see that the icon fillColor has been updated after clicking

https://codesandbox.io/s/l5vojmv7ol

Qwiso avatar Oct 13 '18 15:10 Qwiso

Why is this still open @auser? :(

daiky00 avatar Feb 20 '19 20:02 daiky00

Same issue with fillColor and strokeColor.

rakshit087 avatar Feb 03 '22 20:02 rakshit087