Skip to content

fix(android): don't disable puck bearing and honor followHeading in normal follow mode - #4292

Open
krisgerhard wants to merge 1 commit into
rnmapbox:mainfrom
krisgerhard:fix/android-normal-follow-mode-bearing
Open

fix(android): don't disable puck bearing and honor followHeading in normal follow mode#4292
krisgerhard wants to merge 1 commit into
rnmapbox:mainfrom
krisgerhard:fix/android-normal-follow-mode-bearing

Conversation

@krisgerhard

Copy link
Copy Markdown

Description

Fixes two Android-only bugs in RNMBXCamera.kt's "normal" follow-mode branch. Both are Android/iOS behavior divergences — the iOS implementation has neither.

1. followUserMode="normal" silently disables the LocationPuck bearing (fixes #3391)

The branch sets location.puckBearingEnabled = false, overriding an explicit configuration on the LocationPuck component:

<Camera followUserLocation followUserMode="normal" />
<LocationPuck puckBearingEnabled puckBearing="course" bearingImage="arrow" />

On Android the bearing image freezes pointing north; on iOS it rotates with the course, because the iOS "normal" branch never touches the puck options. This PR removes the override so the puck's own props stay authoritative. The "compass"/"course" branches are left as-is since their SyncWithLocationPuck bearing depends on the puck source they set.

2. followHeading is ignored in normal mode

Both arms of the when (val it = mFollowHeading) passed cameraState.bearing to FollowPuckViewportStateBearing.Constant, so setting followHeading={0} (e.g. for a north-up follow camera) kept whatever bearing the camera already had. The non-null arm now passes it, matching iOS, where followHeading is applied via setCamera.

Testing

Verified on a physical Android device (OnePlus 10 Pro, Android 16) in both debug and release builds with @rnmapbox/maps 10.3.5 + Mapbox SDK 11.27.1, driving with a moving GPS course:

  • Before: switching to followUserMode="normal" + followHeading={0} kept the previous map rotation, and the custom bearingImage froze pointing north.
  • After: the map rotates to north and the bearing image rotates with the course. "course" and "compass" modes unchanged. iOS behavior unchanged (verified on the iOS simulator).

…ormal follow mode

Two fixes in RNMBXCamera's "normal" follow-mode branch, matching iOS behavior:

- Stop setting location.puckBearingEnabled = false: it silently overrides an
  explicit LocationPuck puckBearing/puckBearingEnabled configuration, freezing
  a bearing image pointing north whenever followUserMode is "normal". The iOS
  implementation never touches the puck options here. Fixes rnmapbox#3391.
- Pass the non-null followHeading value to
  FollowPuckViewportStateBearing.Constant: both arms of the when passed
  cameraState.bearing, so followHeading was ignored and entering normal mode
  kept the camera's current bearing.
@krisgerhard
krisgerhard requested a deployment to CI with Mapbox Tokens September 1, 2026 08:49 — with GitHub Actions Waiting
@krisgerhard
krisgerhard requested a deployment to CI with Mapbox Tokens September 1, 2026 08:49 — with GitHub Actions Waiting
@krisgerhard
krisgerhard requested a deployment to CI with Mapbox Tokens September 1, 2026 08:49 — with GitHub Actions Waiting
@krisgerhard
krisgerhard marked this pull request as draft September 1, 2026 08:50
@krisgerhard
krisgerhard marked this pull request as ready for review September 1, 2026 08:52
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.

[Bug]: LocationPuck bearing not visible on Android

1 participant