-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Marker onPress not triggered - touchable area is different than marker itself #4472
Comments
I'm far from an expert but heres my code that works:
on marker press:
most help came from here: https://dev.to/upsilon_it/how-to-do-map-clustering-with-react-native-10ih |
Hi @mishkeTz 👋 My guess is that this is caused by the new renderer on android. The touchable area is the same as always, but the labels beneath your markers are intercepting the taps/clicks (both the markers you are pressing are above city labels). Check out my comment regarding changed behaviour on the new renderer. You are able to trigger the markers onclick "around" it because of this. If you aren't using the POI click listener, you should be able to "fix" this by not registrering the listener (e.g. commenting out): react-native-maps/android/src/main/java/com/airbnb/android/react/maps/AirMapView.java Line 220 in c447dea
Could you try to patch that line and report back if that's the case for you as well? |
@Simon-TechForm I created a patch for this, if anyone finds himself in similar situation:
|
I'm having a similar issue. I have multiple markers and clusters. Any idea how to do so?
|
Hi, I've created a repository based on the solution I'm using in my current project. I hope you'd find it useful: |
Hello, was this addressed in any recent stable release? I struggle to find more discussion about this topic, but at the same time i don't see any viable solution. I disabled mentioned |
I had this same issue (unable to click marker on top of a city name) and the patch for recent releases is slightly different as diff --git a/node_modules/react-native-maps/android/src/main/java/com/rnmaps/maps/MapView.java b/node_modules/react-native-maps/android/src/main/java/com/rnmaps/maps/MapView.java
--- a/node_modules/react-native-maps/android/src/main/java/com/rnmaps/maps/MapView.java
+++ b/node_modules/react-native-maps/android/src/main/java/com/rnmaps/maps/MapView.java
@@ -242,7 +242,7 @@ public class MapView extends com.google.android.gms.maps.MapView implements Goog
markerCollection.setInfoWindowAdapter(this);
markerCollection.setOnMarkerDragListener(this);
- this.map.setOnPoiClickListener(this);
+ //this.map.setOnPoiClickListener(this);
this.map.setOnIndoorStateChangeListener(this);
applyBridgedProps(); |
Thank you @findhumane ! I confirm this fixed my issue |
This also fixed the issue @findhumane. |
Summary
Map-View-record.mov
Reproducible sample code
Steps to reproduce
Expected result
Marker is clickable whenever I click on the rendered marker.
Actual result
The marker touchable area is somewhere around (above) the actual marker. The marker is sometimes not clickable or only part of it is.
React Native Maps Version
1.1.0
What platforms are you seeing the problem on?
Android
React Native Version
0.63.4
What version of Expo are you using?
Not using Expo
Device(s)
Android
Additional information
No response
The text was updated successfully, but these errors were encountered: