Repository navigation
fix(android): defer startup camera change events - #4355
Open
RobJacobson wants to merge 4 commits into
Open
RobJacobson wants to merge 4 commits into
RobJacobson wants to merge 4 commits into
Conversation
- Hold startup camera notifications until attachment callbacks finish applying the initial camera - Emit the current camera once after initialization and preserve subsequent camera events - Keep maps without a Camera and valid zero-coordinate camera positions working
- Buffer startup camera notifications until camera setup is ready - Coalesce startup notifications and preserve later camera changes
- Route native camera notifications through a focused readiness gate - Dispatch the latest camera once attachment callbacks finish
- Verify startup notifications coalesce until camera setup is ready - Verify subsequent notifications and empty startup behave correctly
RobJacobson
marked this pull request as ready for review
October 13, 2026 07:55
This was referenced Oct 14, 2026
mfazekas
requested changes
Oct 14, 2026
mfazekas
left a comment
Contributor
There was a problem hiding this comment.
Thanks, this fixes #4213; we verified it on an emulator, including no-Camera, delayed Camera, re-attach and pans during startup. Splitting this out of RNMBXMapView makes sense, but a separate file and test for two flags is more than it needs; please make it a private anonymous object in RNMBXMapView (private val startupCameraEvents = object { … } calling sendCameraChangedEvents() directly) and drop CameraChangeEventGate.kt and its test. Please also shorten the attach comment to one line, e.g. // Camera.addToMap applies defaultSettings in the attach callbacks (#4213).
This branch was successfully 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 #4213
Android may report a camera change before the map's attachment callbacks apply
Camera.defaultSettings. Buffer startup notifications and dispatch one event from the current camera state after those callbacks complete. Subsequent camera changes continue to emit normally.Reproducer evidence
Using the issue's configured center
[-93.265, 44.9778]:[0, 0], then[-93.265, 44.9778].[-93.26500000000003, 44.9778]; no[0, 0]event was emitted.Validation
This branch adds
CameraChangeEventGateTestcoverage for startup-change coalescing, normal changes after readiness, readiness without a pending change, and repeated readiness calls.The end-to-end checks below were completed on the equivalent one-file implementation in PR #4348, before the gate was extracted into the helper used here. They were not rerun against this exact PR head. The checks used React Native 0.84.1, Mapbox Maps SDK 11.23.1, Fabric, and the Android example app; the issue report's React Native 0.83.6 and SDK 11.20.1 were not rerun.
[-93.265, 44.9778]at zoom 6, with no initial[0, 0]callback.[0, 0], map without a Camera, Camera without defaults, controlled camera props alongside defaults, later move to[0, 0], and later move to Tokyo.yarn generatecompleted without generated changes, andyarn linthad no errors.Checklist
CONTRIBUTING.md.yarn generatein the root folder (not applicable to this native-only change)./exampleapp.Screenshot OR Video
This is a native event timing fix; emulator logs above show the before/after behavior.
Component to reproduce the issue