fix(ios): patch maplibre ViewManager to skip old-arch registration on new arch#1559
Merged
CraigBuckmaster merged 1 commit intoApr 21, 2026
Merged
Conversation
… new arch
Prevents 'Invariant Violation: Tried to register two views with the same
name MLRNCamera' crash on MapScreen mount under RN New Architecture.
Root cause: maplibre-react-native v11.0.0-beta.31 still ships old-arch
ViewManager subclasses (MLRNCameraManager, MLRNMapViewManager) alongside
the new-arch Fabric ComponentViews. Because the ViewManager base class
unconditionally inherits from RCTViewManager, RN's legacy-interop scanner
auto-registers those subclasses under view names ('MLRNCamera',
'MLRNMapView') that Codegen has already claimed for the Fabric
component views. Both paths register — invariant violation at runtime.
Fix: one-line conditional inheritance in the ViewManager base class —
subclass NSObject when RCT_NEW_ARCH_ENABLED is defined, keep RCTViewManager
otherwise. Removes the managers from RN's registration scanner while
preserving every class symbol the TurboModules reference.
Verified:
- Managers are never instantiated anywhere in the library (pure class-method
namespaces on new arch)
- Only the 'ViewManager' base class inherits from RCTViewManager directly
- Only MLRNCameraManager and MLRNMapViewManager inherit from ViewManager
- Zero RCT_EXPORT_VIEW_PROPERTY macros anywhere in the ObjC source
- v11.0.0 stable has identical iOS source to beta.31 (no upstream fix yet)
Remove this patch when maplibre-react-native ships arch-guarded managers
upstream. File upstream issue tracked as follow-up kanban card.
Test Results✅ All tests passed
Coverage
⏱️ Duration: 79.3s |
This was referenced Apr 21, 2026
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.
Summary
Fixes
Invariant Violation: Tried to register two views with the same name MLRNCameracrash onMapScreenmount under RN New Architecture. This crash was previously masked by the first-launch crash fixed in #1557 / #1558; once the app reaches the main tabs, tapping Map triggers this separate invariant violation, propagates pastMapErrorBoundarytoRCTFatal→ SIGABRT.Root cause
maplibre-react-native@11.0.0-beta.31(the latest beta and — verified — iOS-identical to the just-releasedv11.0.0stable) still ships old-architectureViewManagersubclasses (MLRNCameraManager,MLRNMapViewManager) alongside its new-arch FabricComponentViews. The sharedViewManagerbase class unconditionally inherits fromRCTViewManager, so RN's legacy-interop scanner auto-registers those subclasses under view names"MLRNCamera"/"MLRNMapView"— the same names Codegen has already claimed viaRCTThirdPartyComponentsProvider.mmfor the Fabric components. Two registrations, same name, boom.I verified upstream has not yet fixed this: zero
RCT_NEW_ARCH_ENABLEDguards in the entireios/tree, andgit diff v11.0.0-beta.31..v11.0.0shows zero iOS changes.Fix
Single-file
patch-packagediff againstViewManager.h: conditional inheritance based onRCT_NEW_ARCH_ENABLED.@interface ViewManager : NSObject— removes the class from RN'sRCTViewManagerscanner, eliminating the legacy registration path.: RCTViewManager), preserving backwards compatibility if new arch is ever toggled off.Why this is safe
I grepped the entire library's iOS source to confirm:
alloc/init/newsMLRNCameraManagerorMLRNMapViewManagerRCTViewManager(not viaViewManager)ViewManagerbase itselfViewManagerMLRNCameraManagerandMLRNMapViewManagerRCT_EXPORT_VIEW_PROPERTY/RCT_EXPORT_MODULEmacrosMLRN*Managerclasses on new-arch paths[MLRNCameraManager handleImperativeStop:...],[MLRNMapViewManager getCenter:...], etc.fireEvent:withCallback:(theViewManagerinstance method)On new arch, these "Manager" classes are pure class-method namespaces for helpers the
TurboModulecode calls. TheirRCTViewManagerlineage is pure cruft from incomplete migration. Swapping the base class toNSObjectpreserves every symbol the Codegen/TurboModule paths reference while cleanly removing the legacy registration.Files changed
app/patches/@maplibre+maplibre-react-native+11.0.0-beta.31.patch(new file, 41 insertions)No changes to
package.json,Podfile,app.config.js, or any JS/TS.patch-packageis already inpostinstall, so this takes effect automatically on nextnpm install.Verification plan (rentamac)
If the map shows blank tiles but renders without crashing, that's network/tiles and a separate issue — this PR's scope is crash-only.
Rollback
Patch is additive; deletion fully reverts.
Ship sequence
Because the fix is native, an
eas updateOTA will not deliver it. After merge:eas build --platform ios --profile productionto produce a fresh TestFlight build containing both the iOS 26 fix (already on master from #1557/#1558) and this Map fix.Follow-up (not blocking)
maplibre/maplibre-react-nativedescribing the double-registration so they ship arch-guarded managers inv11.0.1/v11.1. When that lands, drop this patch.