Skip to content

fix(web): apply MapView projection prop - #4405

Merged
mfazekas merged 1 commit into
mainfrom
fix/web-mapview-projection
Oct 26, 2026
Merged

mfazekas merged 1 commit into
mainfrom
fix/web-mapview-projection

Conversation

@mfazekas

Copy link
Copy Markdown
Contributor

Description

The web MapView ignored the projection prop, so the GlobeProjection example (the one featured on the docs homepage, https://rnmapbox.github.io/example-app/V10/GlobeProjection) rendered flat and its toggle did nothing. projection is now passed to mapboxgl.Map on creation, and changes are applied with setProjection (null when the prop is removed, so the style's projection takes over again). styleURL and the camera defaults were already handled.

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
    • In V11 mode/android
    • In New Architecture mode/android
  • I added/updated a sample - if a new feature was implemented (/example)

Web only. Tested in the example web build (expo start --web) with Playwright.

Screenshot OR Video

I tested without a Mapbox token, so I swapped in an inline style (a background layer plus a lat/lng graticule) on the example's map. Before the fix, the example shows "Change projection to mercator" (globe mode), but map.getProjection() returns mercator and the graticule is flat. After the fix, it renders as a globe, and clicking the button cycles getProjection() through globe → mercator → globe.

Component to reproduce the issue you're fixing

The existing example/src/examples/V10/GlobeProjection.tsx. A unit test in __tests__/web/MapView.test.tsx covers creation and updates, and fails without the fix.

<MapView projection="globe" />

The web MapView ignored `projection`, so the GlobeProjection example
rendered flat and its toggle did nothing. Pass it to mapboxgl.Map and
apply changes with setProjection.
@mfazekas
mfazekas merged commit 859e286 into main Oct 26, 2026
10 checks passed
@mfazekas
mfazekas deleted the fix/web-mapview-projection branch October 26, 2026 13:28

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