Skip to content

feat(PointAnnotation): add priority - #4465

Open
hazel-wl wants to merge 1 commit into
rnmapbox:mainfrom
wanderlog:hazel/upstream-point-annotation-priority
Open

hazel-wl wants to merge 1 commit into
rnmapbox:mainfrom
wanderlog:hazel/upstream-point-annotation-priority

Conversation

@hazel-wl

@hazel-wl hazel-wl commented Dec 1, 2026

Copy link
Copy Markdown

Description

Added priority to PointAnnotation, which sets the order overlapping point annotations are drawn in.

Motivation

  • When PointAnnotations overlap, apps can't choose which one is drawn on top
    • The only way to change it is to re-sort or remount the annotations
  • priority lets an app set the drawing order directly: higher priority annotations are drawn above lower priority ones
  • Apps that don't set priority keep the order they have today on both platforms

Changes

  • New priority prop: on PointAnnotation and its native spec, documented in the generated docs. It's unset by default.
  • iOS: sets the annotation's symbolSortKey. When priority is unset, the sort key stays unset, so iOS keeps ordering annotations by their position on screen.
  • Android: sets the annotation's symbolSortKey, which used to be a fixed 10 for every annotation. Unset now means 0, so annotations without a priority keep the same order. Callouts still use 11, so they stay above annotations unless an annotation's priority is above 11.
  • Example: a "Point Annotation Priority" scene with three overlapping annotations and a button that changes which one has the higher priority

Checklist

  • I've read CONTRIBUTING.md
  • I updated the doc/other generated code with running yarn generate in the root folder
  • I have tested the new feature on /example app.
    • In V11 mode/ios
    • In New Architecture mode/ios
    • In V11 mode/android
    • In New Architecture mode/android
  • I added/updated a sample - if a new feature was implemented (/example)

Testing

  • Ran yarn type:check, yarn lint and yarn generate
  • Opened Annotations → Point Annotation Priority in the example app, on an iOS 26.5 simulator and an Android emulator, and pressed the button to bring each annotation to the top
    • Before: the order never changes, whichever annotation has priority 1
    • After: the annotation with priority 1 is drawn on top each time

Screenshot OR Video

In the example screen, showing the red annotation with priority 1, then the blue annotation with priority 1.

Before After
iOS priority-before-1-red-croppriority-before-2-blue-crop priority-after-1-red-croppriority-after-2-blue-crop
Android android-priority-before-1-red-cropandroid-priority-before-2-blue-crop android-priority-after-1-red-cropandroid-priority-after-2-blue-crop

Sets the annotation's symbol-sort-key, so overlapping point annotations
can be drawn in a chosen order without sorting them. Adds the Point
Annotation Priority example.

This branch was successfully deployed

1 active deployment
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.

1 participant