Repository navigation
fix(ios): stop rendering hidden location pucks - #4431
Open
ajtrasatti wants to merge 4 commits into
Open
ajtrasatti wants to merge 4 commits into
ajtrasatti wants to merge 4 commits into
Conversation
4 of 5 tasks
ajtrasatti
marked this pull request as ready for review
October 31, 2026 14:51
This branch has not been 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.
Problem and fix
Fixes #3787: with
LocationPuck visible={false}, a fixed camera and continuous GPS updates, the iOS wrapper still installs a 2D puck with transparent images. Mapbox interpolates that invisible puck's position and keeps the map rendering, even without pulsing enabled.Set
location.options.puckTypetonilwhile hidden so Mapbox removes the puck renderer. Keep the component's configuration and location provider intact; showing it again rebuilds the configured puck.Addressing the original report and maintainer concern
puckType = nil. We reproduced that hidden-puck behavior on current main with continuous synthetic location updates and a fixed camera. The fixed build settles to zero native render callbacks, with CPU close to the removed-puck control below.FollowPuckViewportStatesubscribes to location interpolation independently of the renderer; puck bearing settings do not control camera following.This addresses the original hidden-puck rendering report. The long-session freeze and
onMapIdleevent-frequency observations in later comments were not reproduced or validated by this change. Following a moving location intentionally continues rendering because the camera is moving.Reproduction and validation
Built and ran the current React Native example with Mapbox iOS 11.33.0 on an iPhone 16 Pro simulator (iOS 18.2). The reproducer below uses a blank background, a fixed camera and synthetic location/heading updates once per second, with no external map data.
CPU is the simulator app process, 100% = one host core, ten one-second CPU-time-delta samples after four warm-up samples, with no screen recording during sampling. These are controlled simulator measurements, not physical-device energy results. Frame callbacks indicate native render activity rather than displayed FPS.
Also verified visible pulse → hidden, and custom image/pulse → hidden → visible restoration. Hidden states with a fixed camera settle to zero render callbacks; showing the puck restores its configuration.
Native example build,
yarn generate,yarn test(lint + 32 suites / 194 tests),yarn type:checkandgit diff --checkpass. The Jest suite mocks native modules; the native Detox regression below and the before/after simulator reproduction validate the Swift behavior. Temporary diagnostic code and example configuration are excluded from the diff.Automated iOS regression coverage
Adds one combined regression to the existing
example/e2e/firstTest.e2e.jssuite and a small local-style/synthetic-location scene:The full existing smoke suite passes (5 tests). The added case takes about 16 seconds locally, including navigation and cleanup. It reuses the existing app launch, has no screenshot processing, and adds no workflow changes, dependencies, or native test target. Assertions check behavior, without CPU thresholds or exact FPS.
Rebuilding with the original transparent-puck implementation makes the hidden-rendering assertion fail (render counter 82 → 199 during the observation window); restoring the fix passes. Custom-image/pulse restoration remains covered by the manual native validation above; its slower repeated screenshot checks are omitted from CI.
Run after building the example for Detox:
Companion Android native pulse lifecycle fix: mapbox/mapbox-maps-android#2739. The two PRs address the hidden-rendering paths at their respective ownership layers.
Reproducer: replace example/src/examples/BugReportExample.js
Use the example's existing access-token setup. Open this example directly (or temporarily import it in
example/index.js). Start athidden-moving, then use Next case to exercise removed/hidden/visible, camera-follow, pulse and custom-image transitions. Watch the live frame counter; rendering should stop in hidden states when the camera is fixed.