Repository navigation
fix(android): emit onMapLoadingError; add the SDK error type to its payload - #4322
Merged
mfazekas merged 2 commits intoOct 11, 2026
Merged
Conversation
…ayload
On Mapbox v11, `MapboxMap.subscribe(observer, events)` is an empty shim in
the compat layer, so Android never emitted `onMapLoadingError`. Subscribe
through `subscribeMapLoadingError` instead, keep the returned Cancelable and
cancel it in `onDropViewInstance`. The payload matches iOS:
`{ error, tileId?, sourceId? }`.
Both platforms now also forward the SDK's error kind as `type`
(`style | sprite | source | glyphs | tile`), so JS can tell a style that
failed to load from a missing sprite, which leaves a usable map.
`onMapLoadingError` is typed with the new `MapLoadingErrorPayload`.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WadDsndRftrfMGcCF1iLea
mfazekas
force-pushed
the
fix/android-map-loading-error
branch
from
October 11, 2026 10:30
523c27f to
5e4df17
Compare
Contributor
|
Thanks @arminzaugg. I rebased this onto current main and pushed it to your branch, keeping your commit, plus a small |
This branch was successfully deployed
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
Fixes
onMapLoadingErrornever firing on Android, and adds the Mapbox SDK's errortypeto its payload on both platforms.Android never emits
onMapLoadingError.RNMBXMapView.onMapReadysubscribes withmap.subscribe(observer, listOf(MapEvents.MAP_LOADING_ERROR)). Under Mapbox v11 that call goes to the compat shim inandroid/src/main/mapbox-v11-compat/v11/.../Event.kt, whose body is a// TODO, so the observer is never registered. This PR subscribes through the v11 API,MapboxMap.subscribeMapLoadingError. It keeps the returnedCancelableand cancels it inonDropViewInstance. The payload now matches iOS:{ error, tileId?, sourceId? }.typeon both platforms. Both SDKs classify each error (MapLoadingError.type:STYLE | SPRITE | SOURCE | GLYPHS | TILEon Android,MapLoadingErrorTypeon iOS), but neither platform forwarded it. Without it, JS can't tell a style that failed to load from a missing sprite: the map still works in the second case, yet the payload looks the same (no tile, no source). The payload gainstype: 'style' | 'sprite' | 'source' | 'glyphs' | 'tile', andonMapLoadingErrorinMapView.tsxis typed with it (MapLoadingErrorPayload).We carry this change as a pnpm patch on 10.3.2 in our app.
Checklist
CONTRIBUTING.mdyarn generatein the root folder — not run;docs/MapView.mdanddocs/docs.jsonstill show() => voidforonMapLoadingError. Happy to push the regenerated files if you prefer them in this PR./exampleapp — not on/example; tested in our own app (below), on 10.3.2 with the same hunks./example)Screenshot OR Video
Measured in our app (Mapbox 11.23.1, rnmapbox 10.3.2, RN 0.85 New Architecture, Android emulator and iOS simulator):
onMapLoadingErrorfor a 404 style, nor for failing tiles.{ type: "style" }event for a 404 style. For a style whose sprite URL fails:{ type: "sprite" }beforeonDidFinishLoadingStyle, then retriedspriteevents.typevalues for the same styles.🤖 Generated with Claude Code
https://claude.ai/code/session_01WadDsndRftrfMGcCF1iLea