Repository navigation
fix: apply StyleImport config before the first frame - #4443
Merged
Merged
Conversation
Apply the import config when the style root is parsed (StyleDataLoaded with type STYLE) instead of after the whole style loads, the same moment the Mapbox SDKs apply MapStyle configuration. With lightPreset: 'night' the map no longer renders day frames and fades to night. Fixes #4438
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
Fixes #4438
StyleImportapplied its config only after the whole style had loaded, so withconfig={{lightPreset: 'night'}}the Standard style rendered day frames and then faded to night. It now applies the config as soon as the style root is parsed (StyleDataLoadedwith typeSTYLE), which is the same point where the iOS SDK'sMapStyleReconcilerappliesMapStyleconfiguration, so the first frame already uses it. Thanks @stianjensen for the analysis in the issue, which pinpointed both the cause and the upstream behavior.The subscription stays across style changes, so a new
styleURLorstyleJSONalso gets the config before its first frame. This applies to any import id, not justbasemap.Verified on the example app (iOS 26 simulator, Android emulator), counting frames whose map area is day-bright across a first mount and a cached remount: iOS 138 → 0, Android 45 → 0 (before the fix, Android showed about 4 s of day on first mount). Also checked on both platforms: switching between standard, standard-satellite and a
styleJSONthat imports Standard asother(night from the first frame each time), and unmounting and remounting the import. On iOS, a runtimelightPresetchange still animates. On Android it switches in a single recorded frame through the same nativesetStyleImportConfigPropertiescall as before; I did not record an unfixed baseline for that case.Checklist
CONTRIBUTING.mdyarn generatein the root folder/exampleapp./example)Screenshot OR Video
Before, iOS first mount: day frames, then a fade to night. After: night from the first map frame. Measured from
simctl io recordVideoandadb screenrecordcaptures.Component to reproduce the issue you're fixing
Tap Mount: on the unfixed build the map shows day frames before fading to night. Unmount and Mount again to check a cached remount.