Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 12 additions & 5 deletions android/src/main/java/com/rnmaps/maps/MapView.java
Original file line number Diff line number Diff line change
Expand Up @@ -505,16 +505,17 @@ public boolean onMarkerClick(@NonNull Marker marker) {
} else {
// Handle native markers added via updateNearbyMarkersFromProcessedData
Object tag = marker.getTag();
String id = null;
String routeCode = null;
String action = "marker-press";
String actionType = null;
boolean isPressFeedbackEnabled = false;
String id = null;

if (tag instanceof java.util.Map) {
java.util.Map tagMap = (java.util.Map) tag;
Object idObj = tagMap.get("id");
if (idObj instanceof String) {
id = (String) idObj;
Object routeCodeObj = tagMap.get("routeCode");
if (routeCodeObj instanceof String) {
routeCode = (String) routeCodeObj;
}
Object actionObj = tagMap.get("action");
if (actionObj instanceof String) {
Expand All @@ -528,6 +529,10 @@ public boolean onMarkerClick(@NonNull Marker marker) {
if (isPressFeedbackEnabledObj instanceof Boolean) {
isPressFeedbackEnabled = (Boolean) isPressFeedbackEnabledObj;
}
Object idObj = tagMap.get("id");
if (idObj instanceof String) {
id = (String) idObj;
}
}

if (id != null) {
Expand All @@ -537,6 +542,7 @@ public boolean onMarkerClick(@NonNull Marker marker) {
WritableMap mapEventData = makeClickEventData(marker.getPosition());
mapEventData.putString("action", "marker-press");
mapEventData.putString("actionType", actionType);
mapEventData.putString("routeCode", routeCode);
mapEventData.putString("id", id);

dispatchEvent(mapEventData, OnMarkerPressEvent::new);
Expand Down Expand Up @@ -2274,10 +2280,11 @@ public void onAnimationEnd(Animator animation) {
if (newMarker != null) {
if(!isCluster && !routeCode.isEmpty()) {
java.util.Map<String, Object> tagMap = new java.util.HashMap<>();
tagMap.put("id", routeCode);
tagMap.put("routeCode", routeCode);
tagMap.put("action", "marker-press");
tagMap.put("actionType", action);
tagMap.put("isPressFeedbackEnabled", isPressFeedbackEnabled);
tagMap.put("id", driverId);
newMarker.setTag(tagMap);
}
nearbyMarkersCache.put(driverId, newMarker);
Expand Down
2 changes: 1 addition & 1 deletion dist/src/sharedTypes.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ export type MarkerPressEvent = NativeSyntheticEvent<{
id: string;
action: 'marker-press';
actionType?: string;

routeCode?: string;
coordinate: LatLng;
/**
* @platform Android
Expand Down
1 change: 1 addition & 0 deletions src/sharedTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ export type MarkerPressEvent = NativeSyntheticEvent<{
id: string;
action: 'marker-press';
actionType?: string;
routeCode?: string;
coordinate: LatLng;

/**
Expand Down
Loading