Description
The ClusteredMarker component sets its zIndex to points + 1 (number of grouped markers + 1):
// lib/ClusteredMarker.js, line 25
<Marker style={{ zIndex: points + 1 }} ...>
Individual child <Marker> components that are not part of a cluster have no zIndex set (defaults to 0). As a result, even when a device pin is rendered visually beside a cluster bubble (not behind it), the cluster captures the tap first because its zIndex is higher.
On Android, the touch hit area of a <Marker> is larger than its visual bounds (known react-native-maps behavior), making this even worse — a cluster several pixels away from a marker can still steal the onPress.
Environment
react-native-map-clustering: 4.0.0
react-native-maps: 1.26.20
react-native: 0.82.1
- Platform: Android (primary), iOS
Steps to Reproduce
- Render several custom
<Marker> components near each other.
- Zoom to a level where some markers form a cluster and one or more remain unclustered nearby.
- Tap the unclustered individual marker.
- Observe:
onClusterPress fires instead of the marker's onPress.
Expected Behavior
Tapping an individual marker that is visually distinct from a cluster should fire the marker's onPress, not the cluster's.
Actual Behavior
The cluster intercepts the tap because its zIndex (points + 1) is higher than the individual marker's default zIndex (0).
Description
The
ClusteredMarkercomponent sets itszIndextopoints + 1(number of grouped markers + 1):Individual child
<Marker>components that are not part of a cluster have nozIndexset (defaults to0). As a result, even when a device pin is rendered visually beside a cluster bubble (not behind it), the cluster captures the tap first because itszIndexis higher.On Android, the touch hit area of a
<Marker>is larger than its visual bounds (knownreact-native-mapsbehavior), making this even worse — a cluster several pixels away from a marker can still steal theonPress.Environment
react-native-map-clustering: 4.0.0react-native-maps: 1.26.20react-native: 0.82.1Steps to Reproduce
<Marker>components near each other.onClusterPressfires instead of the marker'sonPress.Expected Behavior
Tapping an individual marker that is visually distinct from a cluster should fire the marker's
onPress, not the cluster's.Actual Behavior
The cluster intercepts the tap because its
zIndex(points + 1) is higher than the individual marker's defaultzIndex(0).