react-native-clusterer
react-native-clusterer copied to clipboard
Flickering when zooming
https://github.com/JiriHoffmann/react-native-clusterer/assets/41541220/f57957ef-602b-4836-b344-202588c0ddd5
I noticed that the markers used for the cluster glitch when zooming in or out. I believe this is due to a change in the cluster id, which therefore forces a re render, also because I cannot therefore take advantage of the benefits of react.memo. Why this strange behavior of the cluster id? and how to avoid the problem?
Can you provide a code example where the ids change?
I came across the same issue. The cluster_id kept changing with different zoom levels, but stable while just moving the map, even if the cluster marker was memoized. As far as I understand supercluster, this is the intended algorithm - the zoom level is encoded in the cluster id. Which makes sense to me.
Now, I'm not sure if this is the correct way, but it seems to work if I use item.geometry.coordinates[0], item.geometry.coordinates[1] and item.properties.point_count instead of the cluster id for the memo keys as well as the cluster marker key.