Skip to content

feat: support multiple PointAnnotationManagers per MapView #4237

Description

@mfazekas

Background

PointAnnotationManager (added in #4209) currently configures the single shared Mapbox PointAnnotationManager instance that all PointAnnotation components use. This means:

  • Only one slot value per map — last writer wins if two managers are mounted
  • Children of <PointAnnotationManager> are React siblings of the native manager, not routed through it natively, so they all go to the same underlying manager regardless of nesting

What multiple managers would enable

<MapView styleURL="mapbox://styles/mapbox/standard">
  <PointAnnotationManager slot="bottom">
    <PointAnnotation id="a" coordinate={...} />  {/* rendered below buildings */}
  </PointAnnotationManager>

  <PointAnnotationManager slot="top">
    <PointAnnotation id="b" coordinate={...} />  {/* rendered above everything */}
  </PointAnnotationManager>
</MapView>

What's needed

  1. Native: Create a new Mapbox PointAnnotationManager instance per RNMBXPointAnnotationManagerView instead of reusing the shared one. The Mapbox SDK supports multiple annotation managers per map.
  2. Native: Route PointAnnotation children through their parent PointAnnotationManagerView — make them actual native children so they use that specific manager instance.
  3. React: The current wrapper API shape is already correct for this — no user-facing API change needed.

Current API is forward-compatible

The <PointAnnotationManager> wrapping pattern is exactly right for multi-manager support. The implementation just needs to go deeper on the native side.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions