Skip to content

Fix Android/IOS annotation layer ordering for markers, polylines and polygons#121

Open
Siergiej29 wants to merge 2 commits into
nativescript-community:masterfrom
Siergiej29:fix/android-annotation-layer-order
Open

Fix Android/IOS annotation layer ordering for markers, polylines and polygons#121
Siergiej29 wants to merge 2 commits into
nativescript-community:masterfrom
Siergiej29:fix/android-annotation-layer-order

Conversation

@Siergiej29
Copy link
Copy Markdown

@Siergiej29 Siergiej29 commented May 22, 2026

Problem

On Android ans iOS, annotation layer ordering can cause markers to render below polylines or polygons.

Changes

This PR updates the Android/iOS annotation manager configuration to use the marker layer ID consistently when creating:

  • polyline annotation manager
  • polygon annotation manager
  • point annotation manager

Result

Markers render above other annotation layers more consistently.

Scope

Android/iOS

@Siergiej29 Siergiej29 changed the title Fix Android annotation layer ordering for markers, polylines and polygons Fix Android/IOS annotation layer ordering for markers, polylines and polygons May 22, 2026
// Register this bridge for the created MapView
MapboxBridge.registerBridge(self, for: mv)

pointAnnotationManager = mv.annotations.makePointAnnotationManager(id: MapboxBridge.MARKER_LAYER_ID)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you instantiate here when you are already doing it later when accessed?

if polygonAnnotationManager == nil {
polygonAnnotationManager = mv.annotations.makePolygonAnnotationManager()
polygonAnnotationManager = mv.annotations.makePolygonAnnotationManager(
id: "mapbox-ios-polygons",
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you use a static property for the name here too, as you use it in multiple places ?

if polylineAnnotationManager == nil {
polylineAnnotationManager = mv.annotations.makePolylineAnnotationManager()
polylineAnnotationManager = mv.annotations.makePolylineAnnotationManager(
id: "mapbox-ios-polylines",
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you use a static property for the name here too, as you use it in multiple places ?

@farfromrefug
Copy link
Copy Markdown
Member

@Siergiej29 Thank you for this. I made a few comments if you don't mind. Then I ll release it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants