Skip to content

feat: puck prop on NavigationViewport - #34

Merged
mfazekas merged 1 commit into
mainfrom
feat/navigation-puck
Nov 2, 2026
Merged

mfazekas merged 1 commit into
mainfrom
feat/navigation-puck

Conversation

@mfazekas

Copy link
Copy Markdown
Contributor

Fixes #33

Adds a puck prop to <NavigationViewport> with LocationPuck's visible, bearingImage, scale and model (the type is picked from @rnmapbox/maps' LocationPuck props, not duplicated). The binding still owns the puck: iOS builds .puck2D/.puck3D from the props, starting from the SDK's navigation defaults, wherever it set .puck3D(.navigationDefault). Android builds a LocationPuck2D/LocationPuck3D instead of createDefault2DPuck. visible: false hides the puck while the location keeps flowing, so the traveled route line still shrinks. Without the prop nothing changes. The example's navigation screen gets a "Puck" chip during guidance that cycles default / arrow image / 3D car / hidden.

Verified on the iOS simulator and the Android emulator during simulated guidance, switching options mid-route each time:

  • default (no puck prop): the SDK's 3D puck on iOS and its 2D puck on Android, as before;
  • arrow bearingImage from <Images>: shows, and with the camera idle it points north on Beale St and west after the turn onto Mission St on both platforms;
  • 3D model (remote glb): shows and follows the course;
  • hidden: the puck disappears and comes back when switched to default.

Also ran lint, typecheck, tests and yarn docs.

Limitations: scale only applies to the bearingImage puck; topImage, shadowImage, pulsing and puckBearing aren't supported (the puck always follows the course). On iOS a bearingImage that isn't in the style yet is looked up again on every location update, and the SDK's puck shows until it's there. LocationPuck still doesn't work on navigation maps, and the README says to use this prop instead. The example's 3D car loads from the rnmapbox/maps repo on GitHub, so that option needs network access.

@mfazekas
mfazekas force-pushed the feat/navigation-puck branch from 93dc03f to ce863bb Compare October 29, 2026 06:01
Sets the location puck of a navigation map from LocationPuck's visible,
bearingImage, scale and model props. iOS builds the NavigationMapView
puckType from them, Android the LocationPuck2D/3D; without the prop the
SDK's puck shows as before. Changes apply during guidance. The example's
navigation screen gets a puck chip (default, arrow image, 3D car, hidden).

Fixes #33
@mfazekas
mfazekas force-pushed the feat/navigation-puck branch from ce863bb to 7e03308 Compare October 29, 2026 07:59
@mfazekas
mfazekas marked this pull request as ready for review November 2, 2026 04:23
@mfazekas
mfazekas merged commit b4c8668 into main Nov 2, 2026
6 checks passed
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.

Customizable location puck on navigation maps

1 participant