gribnoysup / react-yandex-maps

Yandex Maps API bindings for React
MIT License
327 stars 116 forks source link

custom IconLayout in Placemark with Clustererization of markers makes Placemarks non clickable #278

Open AnastasiaSidorenko opened 3 years ago

AnastasiaSidorenko commented 3 years ago

Hello, It happened that onClick function isn't being called in Placemark, when using custom iconLayout generated with templateLayoutFactory and Placemarks are being clustered. Those Placemarks that were grouped in Clusters after a map loaded and resizing the map that lead to gathering placemarks in clusters(ther weren't in clusters initially) are able to call onClick function, those placemarks that were grouped initially couldn't call onClick function. I would appreciate if you help me or fix this problem if this an actual bug. The link below is an example of this problem. When you remove custom iconLayout Placemark is clickable, otherwise it's not. https://codesandbox.io/s/react-yandex-maps-custon-iconlayout-with-clusterization-d8bsf

mmarkelov commented 3 years ago

@AnastasiaSidorenko there is no simple react way to add event listener for placemarks that generated with templateLayoutFactory. You could see some workarounds in these issues: https://github.com/gribnoysup/react-yandex-maps/issues/150 https://github.com/gribnoysup/react-yandex-maps/issues/130 https://github.com/gribnoysup/react-yandex-maps/issues/27

AnastasiaSidorenko commented 3 years ago

@AnastasiaSidorenko there is no simple react way to add event listener for placemarks that generated with templateLayoutFactory. You could see some workarounds in these issues:

150

130

27

But onClick function actually works after the click on Placemark, but being inside clusterer initially it's not being called. Just comment iconLayout string in Placemark code and onClick function will be trigered. But with custom icon Layout it doesn't work if Placemark is inside a cluster.