JiriHoffmann / react-native-clusterer

React Native clustering library using C++ Supercluster implementation
MIT License
159 stars 20 forks source link

Static clusters with useClusterer hook #8

Closed i-mighty closed 2 years ago

i-mighty commented 2 years ago

Below is how I'm using the useClusterer hook const [points, supercluster] = useClusterer(mapPoints, MAP_DIMENSIONS, region, { minPoints: 5, extent: 1000 }); mapPoint is a state. I expect the clusterer to reload the cluster points when mapPoint changes but that doesn't happen.

i-mighty commented 2 years ago

I would love the points to be updated whenever the mapPoints or region changes. ATM, neither seems to work

ScreamZ commented 2 years ago

@i-mighty When region change, the cluster get recalculated, that's why you have to listen to onRegionChange on the MapView. About the points I can't confirm but I guess it works the same way

JiriHoffmann commented 2 years ago

I just double-checked and updates on both values seem to be working just fine in the example project. Make sure that you are actually updating those values or post a reproducible demo.