Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

[Android] onMarkerClick calls showInfoWindow() on markers that have no info window, raising them above every zIndex

Abierto Apto para principiantes
#6,006 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
1/5
Tiempo estimado
1-3 horas
Aptitud para principiantes
88/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
java, react-native
Área
mobile

Línea de trabajo

Comienza en android/src/main/java/com/rnmaps/maps/MapView.java con el manejo de MapView.onMarkerClick descrito en el issue y luego reproduce el ejemplo de Android proporcionado con dos marcadores y moveOnMarkerPress={false}. Verifica el cambio con la prueba instrumentada de capturas de pantalla descrita en el issue; se considera terminado cuando un marcador tocado sin título ni callout ya no adelanta a un marcador con un zIndex mayor.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

Summary

With moveOnMarkerPress={false}, MapView.onMarkerClick calls marker.showInfoWindow() for every tapped marker, including markers that have no info window at all (no title, no callout child). Google Maps draws the marker whose info window is showing above every other marker regardless of zIndex, and an empty info window still counts. So every tapped marker silently rises above everything else on the map, including markers with a higher zIndex, and stays there until another marker is tapped.

We found this because our selection highlight (a separate marker at zIndex 999999) rendered perfectly but underneath the tapped base pin. Reading the screen pixel at the pin's centre showed the base colour, not the highlight.

Reproducible sample code
<MapView moveOnMarkerPress={false}>
  <Marker coordinate={c} image={basePin} zIndex={1} />          {/* no title, no callout */}
  <Marker coordinate={c} image={highlightPin} zIndex={999999} />
</MapView>
Steps to reproduce

Tap the location. The zIndex 1 marker receives the click.

Expected result

The zIndex 999999 marker stays on top; nothing about a tap should reorder markers that have no info window.

Actual result

The tapped zIndex 1 marker is drawn above the zIndex 999999 one until a different marker is tapped.

Fix
--- a/android/src/main/java/com/rnmaps/maps/MapView.java
+++ b/android/src/main/java/com/rnmaps/maps/MapView.java
@@ -592,7 +592,12 @@
                 if (view.moveOnMarkerPress) {
                     return false;
                 } else {
-                    marker.showInfoWindow();
+                    // Only show an info window the marker actually has: Google draws the
+                    // marker whose info window is showing above every other marker
+                    // regardless of zIndex, and an empty window still counts.
+                    String title = marker.getTitle();
+                    if (airMapMarker.getCalloutView() != null || (title != null && !title.isEmpty())) {
+                        marker.showInfoWindow();
+                    }
                     return true;
                 }
React Native Maps Version

1.29.0 (present on master, v1.29.2)

What platforms are you seeing the problem on?

Android

React Native Version

0.86 (Expo SDK 57), New Architecture

Device(s)

Samsung A13, arm64 emulator (API 36)

Additional information

Verified by an instrumented test that reads the screenshot pixel at the selected pin's centre before and after a real tap. A full write-up will be at https://zackdesign.biz/which-pin-did-you-tap/ shortly.

Lenguaje dominante
TypeScript
Estrellas
16k
Forks
5k
Merge medio
17 h 45 min
PR fusionados (30 d)
2

Guía de contribución

Abrir la guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de react-native-maps/react-native-maps

Todos los issues de react-native-maps/react-native-maps

Issues similares

Más issues de TypeScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.