Skip to content

feat: styling and theming - #29

Merged
mfazekas merged 1 commit into
mainfrom
feat/styling-prototype
Oct 28, 2026
Merged

mfazekas merged 1 commit into
mainfrom
feat/styling-prototype

Conversation

@mfazekas

@mfazekas mfazekas commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Route-line colors, <NavigationView> day/night map styles, and an example of what we do better than the alternatives: the navigation map is a regular @rnmapbox/maps MapView, so markers, layers and React Native controls keep working during guidance.

Motivation: in our comparison with other React Native navigation libraries (items U1 and U4), ATOMIQTECH's headline features are its colors theme and puck options. People also ask the other libraries for styling, e.g. uju777 #15 and homee #92. Custom markers and controls are among Google's most-requested features: #154, #430, #579, #190. We already support them but had no example showing it.

<MapView mapViewImpl={NAVIGATION_MAP_VIEW_IMPL}>
  <NavigationViewport
    routeLineStyle={{
      color: '#7c3aed',          // main route where traffic is low or unknown
      casingColor: '#4c1d95',
      alternativeColor: '#c4b5fd',
      traveledColor: 'rgba(124, 58, 237, 0.35)', // default transparent: the traveled part disappears
    }}
  />
</MapView>

<NavigationView styleURL="mapbox://styles/me/day" nightStyleURL="mapbox://styles/me/night" … />
<RNNavigationView nightStyleURL="…" routeLineStyle={{ color: '#7c3aed' }} … />

Decisions applied:

  1. Ships routeLineStyle (on <NavigationViewport> and <RNNavigationView>), styleURL/nightStyleURL (on <NavigationView> and <RNNavigationView>), and the "Markers" example screen.
  2. Night means system dark mode on both platforms. On iOS, <NavigationView> gives NavigationViewController only the style for the current appearance and swaps it in traitCollectionDidChange. The SDK's style manager picks between several styles by sunrise and sunset even with automaticallyAdjustsStyleForTimeOfDay off (e.g. on a content size change), so usesNightStyleInDarkMode alone isn't reliable. Android loads the night style on onConfigurationChanged. Without URLs both use Mapbox Standard with its night light preset; Android used to stay on the day preset. <RNNavigationView appearance="auto"> now follows useColorScheme() instead of the sun at the user's location, and the JS solar calculation is gone.
  3. No puck API here. The puck problem and the two options (a puck prop, or the binding stepping aside for LocationPuck) go to a separate issue.
  4. No more styling properties for now.

Platform notes:

  1. Route line on iOS: NavigationMapView routeColor/routeAlternateColor (unknown and low congestion), routeCasingColor and traversedRouteColor. The SDK reads these only when it shows routes, so a change re-shows the current routes. NavigationViewController's styles set the same properties through NavigationMapView.appearance(), which reaches every navigation map, so the map reapplies its colors in didMoveToWindow.
  2. Route line on Android: MapboxRouteLineView.updateDynamicOptions with RouteLineColorResources. color maps to default + low + unknown congestion, to match iOS.

Verified on the iPhone 17 simulator (iOS 26.5) and an Android emulator (API 34):

  1. Markers screen with Simulate: purple route with dark casing, translucent traveled part, POI callout, 📍 pins at the puck, overview/follow, Stop/Back. Both platforms.
  2. Recoloring during guidance (a temporary in-app toggle; Fast Refresh restarts the screen's guidance effect): the line recolors right away and keeps vanishing behind the puck. Both platforms.
  3. iOS: after NavigationView and back, the Markers route keeps its custom colors.
  4. NavigationView day/night by toggling system dark mode during guidance, with custom styleURL/nightStyleURL and with the defaults, starting in either mode. The Android route reappears after each style reload. <RNNavigationView> auto follows dark mode too. Both platforms.

Also lint, typecheck (library and example), unit tests (62) and yarn docs.

Limitations:

  1. On iOS a color change during guidance shows the traveled part in the route color for about 0.4 s, until the next location update re-applies the vanishing offset. The SDK methods that would re-apply it right away are internal. Android doesn't flash. Documented in the README.
  2. routeLineStyle isn't on <NavigationView>: on iOS, NavigationViewController's style manager sets route colors through appearance proxies, so it would need a Style subclass that leaks to every navigation map.
  3. The Android <NavigationView> UI (banner, bottom bar) stays in day colors at night; only the map switches.

Possible follow-ups: alternative casing color, traffic congestion colors, line widths, maneuver arrow colors (both SDKs expose them), and puck styling once the puck issue is decided.

…s example

routeLineStyle on <NavigationViewport> and <RNNavigationView>, styleURL and
nightStyleURL on <NavigationView>, and a Markers example screen. Night
follows the system dark mode on both platforms, also for RNNavigationView's
appearance="auto".
@mfazekas
mfazekas force-pushed the feat/styling-prototype branch from 48e426a to 45a46f2 Compare October 28, 2026 10:49
@mfazekas mfazekas changed the title feat: styling and theming (prototype) feat: styling and theming Oct 28, 2026
@mfazekas
mfazekas marked this pull request as ready for review October 28, 2026 11:05
@mfazekas
mfazekas merged commit 1ae9991 into main Oct 28, 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.

1 participant