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

[Question] Custom dynamic react component as custom cluster for iconCreateFunction prop #9

Closed
jaballogian opened this issue Mar 20, 2022 · 1 comment

Comments

@jaballogian
Copy link

Hello, I saw here https://codesandbox.io/s/beautiful-pike-j2l0w that you created the custom cluster UI using the iconCreateFunction prop and createClusterCustomIcon function that returns L.divIcon function.

<MarkerClusterGroup iconCreateFunction={createClusterCustomIcon}>

...

const createClusterCustomIcon = function (cluster: MarkerCluster) {
  return L.divIcon({
    html: `<span>${cluster.getChildCount()}</span>`,
    className: 'custom-marker-cluster',
    iconSize: L.point(33, 33, true),
  })
}

It's the same with the code from another library here https://github.com/YUzhva/react-leaflet-markercluster.

const createClusterCustomIcon = function (cluster) {
  return L.divIcon({
    html: `<span>${cluster.getChildCount()}</span>`,
    className: 'marker-cluster-custom',
    iconSize: L.point(40, 40, true),
  });
}

...

<MarkerClusterGroup iconCreateFunction={createClusterCustomIcon} />

My question is does your library support using custom dynamic component for example pie chart component for the cluster icon?

I had a problem implementing it here https://stackoverflow.com/questions/71522257/useeffect-hook-isnt-triggered-inside-reactdomserver-rendertostring

@akursat
Copy link
Owner

akursat commented Aug 21, 2022

@jaballogian Did you try to generate html with ReactDOMServer.renderToString?

@akursat akursat closed this as completed Dec 28, 2022
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

2 participants