Repository navigation
feat(MapView): add experimental symbolScaleBehavior - #4400
Merged
Merged
Conversation
Map { fixed } to mapbox-gl's experimental scaleFactor. 'system' has no web
equivalent: it warns once and uses a scale of 1.
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
Added an experimental
symbolScaleBehavior?: 'system' | { fixed: number }prop toMapView. It controls how map symbols (labels and icons) scale with the system text size.It maps to iOS
mapboxMap.symbolScaleBehavior = .system/.fixed(scaleFactor:)and AndroidmapboxMap.symbolScaleBehavior = SymbolScaleBehavior.system/SymbolScaleBehavior.fixed(x). Both are experimental and available since 11.19, so they work on the current default 11.23.1. The native default isfixed(1.0), and removing the prop resets to it. The iOS-only custom mapping closure (.system(mapping:)) isn't exposed. The JSDoc marks the prop@experimental.There's a new
Map/SymbolScaleBehaviorexample with buttons for 1x / 1.5x / 2x / system.On web,
{ fixed }maps to mapbox-gl's experimentalscaleFactor(3.8+).'system'has no web equivalent, so web warns once and uses a scale of 1.Checklist
CONTRIBUTING.mdyarn generatein the root folder/exampleapp./example)Screenshot OR Video
I tested the new example on the iOS simulator (iPhone 17 Pro, iOS 26.5) and an Android emulator (Pixel 6), using SDK 11.23.1.
{ fixed: 1 }vs{ fixed: 2 }: on both platforms, labels and icons render at about double size with 2.'system': at the default text size it looks the same as 1x. I then raised the system text size: iOS content sizeaccessibility-extra-extra-extra-large, Androidfont_scale2.0. On both platforms the labels grew to about 2x, while{ fixed: 1 }stayed at normal size. I restored the device settings afterwards.