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

Markers sometimes not appearing on initial render #180

Closed
sammbeller opened this issue Jun 23, 2020 · 7 comments
Closed

Markers sometimes not appearing on initial render #180

sammbeller opened this issue Jun 23, 2020 · 7 comments

Comments

@sammbeller
Copy link

First I'd like to thank you for the work on this library, it's been very helpful.

I'm running into an issue where sometimes markers and custom clusters aren't appearing on the initial render of the map. Digging in with React Native Debugger, I see that the memo component wrapping the MapView has the expected number of children (which are the markers I'm passing in). The MapView, however, has 4 children that are empty arrays. Moving the map or changing the zoom level makes everything render correctly. Please let me know if any further information would be helpful.

@pdugan20
Copy link

Seeing the same thing here: #171. Clusters won't update unless you drag the map around.

@sammbeller
Copy link
Author

@pdugan20 just looked through your code sample, I'm wondering if this isn't because we're defining custom cluster components. I know there's at least one place in the code where it introspects the cluster's props (looking at it's coordinates prop). It looks like the author of this library isn't going to respond too quickly so please share anything you discover and I'll do the same.

@sammbeller
Copy link
Author

As far as I cant tell this is because of the memoization of children in the ClusteredMapView. When using React Native Debugger, the Memo component that is a parent of the MapView has all the children I'd expect, but the MapView's children are empty arrays.

@sammbeller
Copy link
Author

The above seems to have been a red herring. @pdugan20 the below patch seems to fix the problem for me.

      updateRegion(restProps.region || restProps.initialRegion);

Can you add that line to ClusteredMapView.js on line 93 immediately above where the bBox (bounding box) is computed and let me know if that fixes some of your issues? I'd like to get some more validation on this small fix. If it works I'll open a PR.

@sammbeller
Copy link
Author

Opened a PR for this here

@pdugan20
Copy link

Haven't had a chance to test this yet but my original problems were related to the region prop not updating correctly so willing to bet this would likely improve on what I was seeing.

@tomekvenits
Copy link
Owner

Fixed in version 3.4.0

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

3 participants