Repository navigation
fix(web): ShowMapLocalStyle and GlobeProjection examples on web - #4386
Merged
Merged
Conversation
Web MapView now parses a style JSON passed in styleURL, as native does. The local style asset drops its empty sprite/glyphs entries, which mapbox-gl rejects. GlobeProjection pointed at a style that no longer exists; it now uses the satellite streets style.
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
Three examples looked broken in the web example app:
styleURL, which native accepts. Web handed it to mapbox-gl as a URL, so it requested the JSON as a path and got a 404. WebMapViewnow parsesstyleURLas JSON when it starts with{. With that fixed, mapbox-gl still rejected the style because the asset has"glyphs": ""(and an emptysprite). Native ignores those. I removed them from the asset, and the style has no symbol layers, so nothing else changes.mapbox://styles/mapbox-map-design/ckhqrf2tz0dt119ny6azh975y. The Styles API now answers "Style not found" for it, so it's blank on every platform. It now usesStyleURL.SatelliteStreet.Checklist
CONTRIBUTING.mdyarn generatein the root folder/exampleapp./example)Screenshot OR Video
I tested on web only: an
expo export -p webbuild served under/example-app/, plusexpo start --web. Before the fix, ShowMapLocalStyle was blank with a 404 and GlobeProjection was blank with a 404 from the Styles API. After the fix, both render with no errors.Component to reproduce the issue you're fixing
Open Map > Show Map Local Style and V10 > Globe Projection in the web example app.