Repository navigation
fix(ios): add features to an external map once its style finishes loading - #4420
Merged
Merged
Conversation
…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.
This branch was previously 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
For a map that
RNMBXMapViewdoesn't own (from a map-view factory, see #4412/#4417), iOS only added child sources and layers ifisStyleLoadedwas true at hand-over, or on a laterstyleLoadedevent.isStyleLoadedalso waits for sources, so on the Mapbox Navigation CarPlay guidance map it was already false again at hand-over (route sources still loading). NostyleLoadedfollowed, 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 currentisStyleLoaded().Only the SPI/external-map path changes. Intended for 10.3.16 with #4417 and #4419. #4419 applies cleanly on top.
Checklist
CONTRIBUTING.mdyarn generatein the root folder/exampleapp./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.