Uh oh!
There was an error while loading. Please reload this page.
fix(ios): custom LocationPuck images missing on initial style load - #4291
Open
SamuelBrucksch wants to merge 1 commit into
Open
fix(ios): custom LocationPuck images missing on initial style load#4291SamuelBrucksch wants to merge 1 commit into
SamuelBrucksch wants to merge 1 commit into
Conversation
RNMBXImages did not override waitForStyleLoad, so it was added on subview insert. With an async styleURL that happens before the style has loaded, and because RNMBXMapView marks the feature entry addedToMap, addFeaturesToMap skips it on .styleLoaded - the images never reach the loaded style. Layers mask this via the style's image-missing event, but RNMBXNativeUserLocation reads style.imageExists directly and silently falls back to Puck2DConfiguration.makeDefault().
SamuelBruckschrequested a deployment
to
CI with Mapbox Tokens
August 31, 2026 05:42 — with
GitHub Actions
Waiting
SamuelBruckschrequested a deployment
to
CI with Mapbox Tokens
August 31, 2026 05:42 — with
GitHub Actions
Waiting
SamuelBruckschrequested a deployment
to
CI with Mapbox Tokens
August 31, 2026 05:42 — with
GitHub Actions
Waiting
SamuelBrucksch
marked this pull request as ready for review
August 31, 2026 05:46
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 freeto 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.
RNMBXImagesis the only style-image producer that doesn't overridewaitForStyleLoad(), so it registers on subview insert. With an asyncstyleURLthat's before the style has loaded, and sinceRNMBXMapViewmarks the entryaddedToMap,addFeaturesToMapskips it on.styleLoaded— the images never reach the rendered style.Layers mask this: a missing icon fires the style's image-missing event and
addMissingImageToStyleadds it on demand (at the cost of anonImageMissingburst on every load).RNMBXNativeUserLocationcan't —_fetchImagesreadsstyle.imageExistsdirectly, so_apply()hits.makeDefault()and aLocationPuckwith a validtopImagesilently renders as the stock blue puck.Initial load only:
applyStyleURLgatesrefreshComponentsBeforeStyleChange()and the re-add on!initialLoad, so a style switch works. A localstyleJSONalso masks it, being applied before the components mount.Waiting is consistent with the rest:
RNMBXLayerandRNMBXNativeUserLocationalready override totrue, and Android registers fromStyle.OnStyleLoaded(requiresStyleLoaddefaults totruethere). Nothing can consume style images before the style exists, andaddFeaturesToMappreserves subview order, so an<Images>above its consumers is still registered first.Verified on device (iOS + CarPlay, 10.3.5 / Maps SDK 11.29.0) with a remote
styleURL,<Images nativeAssetImages={['car_icon']}>and<LocationPuck topImage="car_icon" />: before, the default puck plusonImageMissingfor images that are innativeAssetImages; after, the custom puck on first load and no missing-image burst.