feat(PointAnnotationManager): multiple managers with independent slots & properties#4240
Merged
Merged
Conversation
…ent slots and properties Each PointAnnotationManager now owns its own Mapbox annotation layer, so multiple managers can sit in different slots of the Standard style. PointAnnotations associate with a manager by being its direct children; bare PointAnnotations keep working via a default manager. A `default` manager can be declared to configure the slot/properties used by those bare annotations. Exposes manager-level properties: id, slot, iconAllowOverlap, iconIgnorePlacement, iconOptional, textAllowOverlap, textIgnorePlacement, textOptional. - iOS: per-component RNMBXPointAnnotationManager (own layerId), tap/long-press/ deselect routed across all managers, child mounting in Fabric. - Android: per-component coordinator (own layerId), click/drag routed across all coordinators, child wiring in the view manager. - Backwards compatible: bare PointAnnotations route to the default manager.
… (pitched 3D view)
6 tasks
mfazekas
added a commit
that referenced
this pull request
Jul 5, 2026
…ager (#4246) * fix(PointAnnotationManager): override getDelegate on Android view manager RNMBXPointAnnotationManagerViewManager (added in #4240) never overrode getDelegate(), so under Fabric its props (slot, iconAllowOverlap, …) were never applied and React Native logged: ReactNoCrashSoftException: ViewManager using codegen must override getDelegate method (name: RNMBXPointAnnotationManager). As a result multiple PointAnnotationManagers rendered blank on Android. Provide the codegen delegate like the other view managers (RNMBXCalloutManager, RNMBXMarkerViewManager). * fix(PointAnnotationManager): don't clobber Android iconAllowOverlap default The Android annotation plugin defaults iconAllowOverlap/iconIgnorePlacement to true so annotations always show. applyProps() unconditionally wrote the (nullable) props, so when they were unset it pushed null and reset the manager to the style-spec default (false), culling colliding pins. In the PointAnnotationManager Slot example this dropped pin 2. Only write each option when the prop is actually set.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Builds on #4209. Previously there was a single shared point annotation manager per
MapView, so the<PointAnnotationManager slot>introduced in #4209 could only configure that one manager — two managers with different slots was impossible.Now each
<PointAnnotationManager>owns its own Mapbox annotation layer, so multiple managers can sit in different slots of the Standard style.PointAnnotations associate with a manager by being its direct children. BarePointAnnotations (not wrapped in a manager) keep working via a default manager — fully backwards compatible. A manager can be flaggeddefaultto configure the slot/properties used by those bare annotations.New manager props:
id,default,slot,iconAllowOverlap,iconIgnorePlacement,iconOptional,textAllowOverlap,textIgnorePlacement,textOptional.Implementation notes:
RNMBXPointAnnotationManagerwith its own layer id (auto-generated by the SDK unlessidis set); tap / long-press / deselect are routed across all registered managers; children mounted via Fabric.RNMBXPointAnnotationCoordinatorwith its own layer id; click/drag routed across all coordinators; children wired through the view manager.PointAnnotationresolves to the default manager, which is what adefault-flagged<PointAnnotationManager>configures.Checklist
CONTRIBUTING.mdyarn generatein the root folder/exampleapp./example)Screenshot OR Video
Example
Annotations › PointAnnotationManager Multiple, on the iOS simulator (New Architecture). Two managers in different slots over a pitched 3D view of Lower Manhattan: theslot="bottom"pins (red B) render behind the Standard style's 3D buildings while theslot="top"pins (blue T) render in front — z-ordering that a single shared manager could not produce. Android compiles (Kotlin); runtime not yet exercised.Component to reproduce
See
example/src/examples/Annotations/PointAnnotationManagerMultiple.tsx.