JustFly1984 / react-google-maps-api

React Google Maps API
MIT License
1.81k stars 437 forks source link

Clustering position css (top, left) not added when using styles prop #1847

Closed orlahowell closed 3 years ago

orlahowell commented 3 years ago

Please provide an explanation

When using MarkerClusterer, and passing a custom array for the clusters via the styles prop, the top and left absolute positioning css styles are not added to the cluster div. This means the clusters are in the center of the page, and don't move relative to the map.

Your Environment

os: windows react version: 16.13.1 webpack version: 4.41.0 @babel version: 7.6.0 @react-google-maps/api version: 2.0.2

Basic implementation of incorrect behavior in codesandbox.com

https://codesandbox.io/s/exciting-mclaren-wci58?file=/src/index.js

orlahowell commented 3 years ago

Found the issue - didn't pass anchorIcon to the styles array object and so the position was returning NaN.