react-native-maps: Overlapping markers being pressed will trigger onSelect multiple times
Each press will trigger multiple markers select event. Tried event.stopPropagation and event.preventDefault but does not work. Any clue?

About this issue
- Original URL
- State: closed
- Created 7 years ago
- Reactions: 35
- Comments: 38
Commits related to this issue
- Workaround for issue react-community/react-native-maps#1353 — committed to jerolimov/react-native-maps by jerolimov 6 years ago
- Fix for https://github.com/react-community/react-native-maps/issues/1353 — committed to schalkwijk/react-native-maps by schalkwijk 6 years ago
Hi guys, is there an update on this issue?
Have you tried:
pointerEvents="auto”In the Marker? That fixed it for me.
Still having this issue in 2023… Setting the pointerEvents to auto did not work in my case. Anyone knows of another workaround?
Hmm that
pointerEvents="auto"flag didn’t fix it for me. Would really love to see a fix for this.This issue is still a problem and should be reopened.
Feb 21 and I’m facing the same behavior.
Please don’t close this issue. Up.
Same issue. Any updates or news?
This is currently biting me as well. This didn’t happen a few versions ago but while using the new version of expo tapping on markers that are close to each other is an exercise in frustration.
Focus jumps back and forth between the markers that are in close proximity, making it quite hard to get the callout you want.
Hey @Marswang92, I added it because
onSelectwasn’t being called when tapping on a marker’s subview.I just tested it again in RN 0.44, and I’m experiencing something similar to you guys. What’s weird is that the callout jumps to a nearby marker, but the
onPressevent of that second marker is not fired.In my case,
pointerEvents="auto”worked but it’s not as snappy without it, there is maybe half a second (or actually, almost a second) between the press and the display of the label. Would be really awesome to see this fixed rather than looking for workarounds.[Off-topic] When marker spacing is tight, for example 5 meters, user cannot zoom in tight enough to select individual markers with a finger tip. Especially on iOS using Apple Maps.
How can you scatter markers to spread apart and enable individual selection of densely packed or over-lapping markers? Is the technique in below image called clustering?
Or is clustering combining markers into one?
Are there solutions to implement marker expansion in react-native-maps ?
This happens because the method
_handleTapin the objc class AIRMapMarker calls[marker.map selectAnnotation:marker animated:NO], which triggersshowCalloutViewagain (sometimes on a different marker if they are too close, I’m guessing that’s just how MKMapView works). The call toselectAnnotationshould be removed in my opinion.pointerEvents="auto"seems to make you unable to rely ononPresswhich are now randomly called… Not a solid workaround.If you don’t use
onSelectprop, you should definitely remove what is added in this PR: https://github.com/react-native-maps/react-native-maps/pull/1079 Using patch-package make this easy!I ended up with this in
patches/react-native-maps+0.26.1.patchWould this be fixed by setting AIRMapMarker.m:189 to
tapGestureRecognizer.cancelsTouchesInView = YES;? It’s currently NO so the map marker touches propagate.Did anyone figure out a solution or workaround to this yet?