react-native-map-clustering icon indicating copy to clipboard operation
react-native-map-clustering copied to clipboard

How to disable mapview onPress event when I touch the cluster component(default)

Open dreamkyr opened this issue 4 years ago • 2 comments

I am using latest package version and I have app logic to create map marker and get coordinate info when I tap any map area. After implementing the clustering on my map with onClusterPress props, clustering zoom event and my map press event are being triggered at the same time always. I need to disable mapview onPress event when I click only clustering circle component which is including the numbers of markers.

Pleaes help me. Thanks

dreamkyr avatar Oct 12 '20 03:10 dreamkyr

I have the same problem and don't know how to fix it either

MarcHbb avatar Oct 21 '20 12:10 MarcHbb

You cant disable mapview onPress in default cluster component without edit library.

If you are using a customCluster (renderCluster function) you just need to call stopPropagation() event in native event.

const onClusterPress=(e)=>{
    e.stopPropagation()
  }
.
.
.
  <Marker style={MARKER} coordinate={coordinate} onPress={onClusterPress}>
 

dann1609 avatar Jan 29 '21 15:01 dann1609