API reference
Core
| Name | Description |
|---|---|
| Navigation | The headless navigation API: route requests, the app's single guidance session, and its events. It's also the default export. |
| NAVIGATION_MAP_VIEW_IMPL | Pass 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}>. |
| CameraState | Camera 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. |
| DistanceUnit | Unit of the distances navigation UIs show and voice instructions use. |
| SessionState | The app's navigation session: idle tracks nothing; freeDrive matches the location to the road without a route, see Navigation.startFreeDrive; activeGuidance follows a route. |
| StartActiveGuidanceOptions | Options of Navigation.startActiveGuidance. |
| StartFreeDriveOptions | Options of Navigation.startFreeDrive. |
Components
| Name | Description |
|---|---|
| CarMap | Adds 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. |
| NavigationView | Full-screen turn-by-turn navigation UI: NavigationViewController from MapboxNavigationUIKit on iOS, and an equivalent built from the Navigation SDK UI components on Android. |
| NavigationViewport | Configures 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. |
| CarMapActivity | What the car screen shows, passed to a CarMap render function. |
| CarMapProps | Props of CarMap. |
| NavigationViewError | Passed to onError of NavigationView and RNNavigationView. |
| NavigationViewportProps | Props of NavigationViewport. |
| NavigationViewProps | Props of NavigationView. Pass either route or waypoints. |
| RNNavigationViewAppearance | auto follows the system's dark mode, like <NavigationView>. |
| RNNavigationViewProps | Props of RNNavigationView: NavigationViewProps, plus the props below. |
| RouteLineStyle | Colors of the route lines the Navigation SDK draws on a navigation map. Unset colors keep the SDK defaults. |
| ViewportPadding | Points from the map's edges, ignoring the safe area. |
Routes
| Name | Description |
|---|---|
| Route | A 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. |
| LineString | GeoJSON LineString. |
| MatchedRouteRequestOptions | Options of Navigation.requestMatchedRoutes. |
| Position | GeoJSON order, same as @rnmapbox/maps. |
| RouteLeg | The part of a route between two consecutive waypoints. |
| RouteRequestOptions | Options of Navigation.requestRoutes. |
| RouteResponse | Result of Navigation.requestRoutes. alternatives is empty unless requested. |
| RouteStats | From Navigation.getRouteStats. |
| RouteStep | A maneuver and the road up to the next one, in steps of RouteLeg. |
| Waypoint | A coordinate, or a coordinate with options. |
Events
| Type Alias | Description |
|---|---|
| ArriveEvent | From Navigation.addArriveListener and onArrive. |
| BannerComponent | A piece of a banner instruction, see the Mapbox Directions banner_instructions components. |
| Lane | A lane at the next maneuver, in lanes of RouteProgressEvent. |
| LocationEvent | The location snapped to the road or the route. |
| RouteChangeEvent | From Navigation.addRouteChangeListener. |
| RouteProgressEvent | From Navigation.addRouteProgressListener and onRouteProgress. |
| SpeedLimit | Posted speed limit, in LocationEvent. |
| VoiceInstructionEvent | From Navigation.addVoiceInstructionListener. |