[Android] onMarkerClick calls showInfoWindow() on markers that have no info window, raising them above every zIndex
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 1/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 88/100
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
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de react-native-maps/react-native-maps
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 90/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
react-native-maps/react-native-maps#5987 · 1 comentario ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
react-native-maps/react-native-maps#5977 · 2 comentarios · 1 reacción ·
Todos los issues de react-native-maps/react-native-maps
Issues similares
-
blocklist removal
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
MetaMask/eth-phishing-detect#296544 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
pastelsky/bundlephobia#1122 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
-
category/development priority/P2 scope/file-operations scope/testing type/enhancement
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
-
Enatega Customer and Rider app: Add-ons price is not visible to customer after order is placed. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100