Skip to content

fix(ios): add features to an external map once its style finishes loading - #4420

Merged
mfazekas merged 1 commit into
mainfrom
fix/external-map-style-loaded
Oct 27, 2026
Merged

mfazekas merged 1 commit into
mainfrom
fix/external-map-style-loaded

Conversation

@mfazekas

Copy link
Copy Markdown
Contributor

Description

For a map that RNMBXMapView doesn't own (from a map-view factory, see #4412/#4417), iOS only added child sources and layers if isStyleLoaded was true at hand-over, or on a later styleLoaded event. isStyleLoaded also waits for sources, so on the Mapbox Navigation CarPlay guidance map it was already false again at hand-over (route sources still loading). No styleLoaded followed, so the children of <CarMap> never appeared. The map now checks again on each source/style data load until the style is loaded, then adds the features once, inits the style waiters and cancels the observers.

Android has no such gap: MapboxMap.getStyle(callback) calls back as soon as a style has loaded once, and doesn't depend on the current isStyleLoaded().

Only the SPI/external-map path changes. Intended for 10.3.16 with #4417 and #4419. #4419 applies cleanly on top.

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 V11 mode/ios
    • In New Architecture mode/ios (build only)
    • In V11 mode/android
    • 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

Reproduced with the CarPlay guidance map in rnmapbox/navigation#17's example on the CarPlay simulator: a <CarMap> CircleLayer stayed missing on 10.3.15, and with this change both features were added to the guidance map.

…ding

An external map's isStyleLoaded can still be false at hand-over (e.g. the
Mapbox Navigation CarPlay guidance map while route sources load) and no
further styleLoaded event follows, so its child layers and sources were
never added. Check again on each source/style data load until it's loaded.
@mfazekas
mfazekas merged commit 7a6594f into main Oct 27, 2026
10 checks passed
@mfazekas
mfazekas deleted the fix/external-map-style-loaded branch October 27, 2026 16:24

This branch was previously deployed

1 inactive deployment
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