Skip to content

fix(PointAnnotationManager): override getDelegate on Android view manager#4246

Merged
mfazekas merged 2 commits into
mainfrom
fix/point-annotation-manager-android-getdelegate
Jul 5, 2026
Merged

fix(PointAnnotationManager): override getDelegate on Android view manager#4246
mfazekas merged 2 commits into
mainfrom
fix/point-annotation-manager-android-getdelegate

Conversation

@mfazekas

@mfazekas mfazekas commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

Description

Fixes an Android regression introduced by #4240. The new RNMBXPointAnnotationManagerViewManager never overrode getDelegate(), so under Fabric its props (slot, iconAllowOverlap, textAllowOverlap, …) were never applied and React Native logged a soft exception:

ReactNoCrashSoftException: ViewManager using codegen must override getDelegate method (name: RNMBXPointAnnotationManager).

As a result, PointAnnotationManagers rendered blank on Android — the PointAnnotationManager Multiple example showed no pins. This adds the codegen delegate, matching the other view managers (RNMBXCalloutManager, RNMBXMarkerViewManager). iOS was unaffected (props are applied via updateProps in the component view).

Verified on an emulator (New Architecture): with the fix the soft exception is gone and the top-slot pins render in front of the Standard style's 3D buildings while the bottom-slot pins are occluded behind them, matching iOS.

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 New Architecture mode/ios
    • In New Architecture mode/android
  • I added/updated a sample - if a new feature was implemented (/example)

Component to reproduce the issue you're fixing

Two managers in different slots — renders blank on Android without this fix
<MapView styleURL="mapbox://styles/mapbox/standard">
  <Camera defaultSettings={{ centerCoordinate: [-74.0115, 40.711], zoomLevel: 15.7, pitch: 62 }} />
  <PointAnnotationManager slot="bottom" iconAllowOverlap>
    <PointAnnotation id="b" coordinate={[-74.0145, 40.7085]}>
      <View style={{ width: 26, height: 26, borderRadius: 13, backgroundColor: 'crimson' }} />
    </PointAnnotation>
  </PointAnnotationManager>
  <PointAnnotationManager slot="top" iconAllowOverlap>
    <PointAnnotation id="t" coordinate={[-74.014, 40.7085]}>
      <View style={{ width: 26, height: 26, borderRadius: 13, backgroundColor: 'royalblue' }} />
    </PointAnnotation>
  </PointAnnotationManager>
</MapView>

Or run Annotations › PointAnnotationManager Multiple in the example app.

…ager

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).
…efault

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.
@mfazekas mfazekas merged commit fd9827f into main Jul 5, 2026
7 checks passed
@mfazekas mfazekas deleted the fix/point-annotation-manager-android-getdelegate branch July 5, 2026 11:51
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