Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Request for Dynamic Cluster Coloring Without Using renderCluster #277

Open
vassantn opened this issue Nov 7, 2024 · 0 comments
Open

Request for Dynamic Cluster Coloring Without Using renderCluster #277

vassantn opened this issue Nov 7, 2024 · 0 comments

Comments

@vassantn
Copy link

vassantn commented Nov 7, 2024

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.
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant