Skip to main content

API reference

Core​

NameDescription
NavigationThe headless navigation API: route requests, the app's single guidance session, and its events. It's also the default export.
NAVIGATION_MAP_VIEW_IMPLPass as mapViewImpl to an @rnmapbox/maps MapView to render the route line, the puck and the navigation camera on it: <MapView mapViewImpl={NAVIGATION_MAP_VIEW_IMPL}>.
CameraStateCamera of navigation maps. following follows the puck, tilted and rotated with the route; overview fits the rest of the route; idle leaves the map to the user's gestures and @rnmapbox/maps Camera.
DistanceUnitUnit of the distances navigation UIs show and voice instructions use.
SessionStateThe app's navigation session: idle tracks nothing; freeDrive matches the location to the road without a route, see Navigation.startFreeDrive; activeGuidance follows a route.
StartActiveGuidanceOptionsOptions of Navigation.startActiveGuidance.
StartFreeDriveOptionsOptions of Navigation.startFreeDrive.

Components​

NameDescription
CarMapAdds its @rnmapbox/maps children to the map on the car screen (CarPlay, Android Auto) instead of the phone's. Render it in the component passed to Navigation.registerCarPlayRoot, and in the app for Android Auto and for iOS apps without a CarPlay root; while a CarPlay root is mounted, only its <CarMap> renders. It takes no space on the phone and renders nothing while no car screen shows a map. Views such as MarkerView and taps on the map aren't supported on car screens.
NavigationViewFull-screen turn-by-turn navigation UI: NavigationViewController from MapboxNavigationUIKit on iOS, and an equivalent built from the Navigation SDK UI components on Android.
NavigationViewportConfigures the navigation camera of the @rnmapbox/maps MapView it's a child of: <MapView mapViewImpl={NAVIGATION_MAP_VIEW_IMPL}><NavigationViewport padding={{ bottom: 120 }} /></MapView>. Without it the SDK defaults apply: the safe area plus a small margin on iOS, no padding on Android.
RNNavigationView<NavigationView> built in React Native from the headless API, on an @rnmapbox/maps navigation map: a maneuver banner with road shields, exit numbers and lanes, speed limit, road name, trip progress, mute, overview/recenter and end buttons, and an arrival card. Navigation maps draw the alternative routes of its guidance; tapping one switches to it.
CarMapActivityWhat the car screen shows, passed to a CarMap render function.
CarMapPropsProps of CarMap.
NavigationViewErrorPassed to onError of NavigationView and RNNavigationView.
NavigationViewportPropsProps of NavigationViewport.
NavigationViewPropsProps of NavigationView. Pass either route or waypoints.
RNNavigationViewAppearanceauto follows the system's dark mode, like <NavigationView>.
RNNavigationViewPropsProps of RNNavigationView: NavigationViewProps, plus the props below.
RouteLineStyleColors of the route lines the Navigation SDK draws on a navigation map. Unset colors keep the SDK defaults.
ViewportPaddingPoints from the map's edges, ignoring the safe area.

Routes​

NameDescription
RouteA route from Navigation.requestRoutes, backed by the native SDK route. The getters read a copy taken when the route was created, so they're synchronous. Routes don't survive a JS reload.
LineStringGeoJSON LineString.
MatchedRouteRequestOptionsOptions of Navigation.requestMatchedRoutes.
PositionGeoJSON order, same as @rnmapbox/maps.
RouteLegThe part of a route between two consecutive waypoints.
RouteRequestOptionsOptions of Navigation.requestRoutes.
RouteResponseResult of Navigation.requestRoutes. alternatives is empty unless requested.
RouteStatsFrom Navigation.getRouteStats.
RouteStepA maneuver and the road up to the next one, in steps of RouteLeg.
WaypointA coordinate, or a coordinate with options.

Events​

Type AliasDescription
ArriveEventFrom Navigation.addArriveListener and onArrive.
BannerComponentA piece of a banner instruction, see the Mapbox Directions banner_instructions components.
LaneA lane at the next maneuver, in lanes of RouteProgressEvent.
LocationEventThe location snapped to the road or the route.
RouteChangeEventFrom Navigation.addRouteChangeListener.
RouteProgressEventFrom Navigation.addRouteProgressListener and onRouteProgress.
SpeedLimitPosted speed limit, in LocationEvent.
VoiceInstructionEventFrom Navigation.addVoiceInstructionListener.