Skip to content

Request for Dynamic Cluster Coloring Without Using renderCluster #277

@vassantn

Description

@vassantn

Problem Statement

Our project requires dynamic cluster coloring based on specific conditions, such as the presence of particular markers (e.g., user markers) within the cluster. Currently, the only way to achieve this in react-native-map-clustering is to use the renderCluster function, which:

  • Requires overriding the entire cluster rendering logic.
    
  • Limits the flexibility of maintaining the library's default behavior for cluster appearance and behavior.
    

Current Workaround

The current approach involves using renderCluster to:

  1. Retrieve each cluster’s child markers with superClusterRef.
    
  2. Check if any child markers match specific conditions (like specific user markers).
    
  3. Override the default cluster color based on the results of this check.
    

While this approach technically works, it is not efficient or ideal due to the above limitations.

Feature Request

We request the addition of a dynamic cluster color property that allows:

  • Clusters to be styled based on certain properties or conditions without redefining renderCluster.
    
  • Ability to pass a callback or configuration to adjust colors based on each cluster’s content, while preserving the default renderCluster behavior
    

This approach would:

  • Simplify the implementation by removing the need for renderCluster.
    
  • Allow for conditional styling while preserving the default functionality and performance of the library.
    

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions