# AvoidFeature [#avoidfeature] ```ts const preferences = { avoids: [AvoidFeature.TOLL_ROAD, AvoidFeature.FERRY] } ``` Pass one or more values in [`itinerary.preferences.avoids`](/api/itinerary). A route can still include a feature if there is no suitable alternative. ## Values [#values] | Value | Description | | ------------------------------- | ---------------------------------------------------------------------- | | `AvoidFeature.TOLL_ROAD` | Roads that charge a toll. | | `AvoidFeature.LIMITED_ACCESS` | Highways with restricted entry and exit, such as freeways. | | `AvoidFeature.FERRY` | Crossings that require taking a ferry. | | `AvoidFeature.TUNNEL` | Road segments that pass through tunnels. | | `AvoidFeature.DIRT_ROAD` | Roads classified as dirt roads. | | `AvoidFeature.SEASONAL_CLOSURE` | Roads or crossings that close seasonally. Closure dates are estimates. | | `AvoidFeature.U_TURN` | A maneuver that reverses the direction of travel on the same road. | # Itinerary [#itinerary] Pass an `Itinerary` to `plan()` to compare routes or to `startNavigation()` to start guidance. Both methods are available from [`useNavigation()`](/hooks/use-navigation). ## Fields [#fields] ### Itinerary Ordered stops and routing preferences for a trip. | Prop | Type | Description | | -------------- | ----------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `waypoints` | `readonly [Origin, ...Waypoint[], Endpoint]` | At least two points in `[longitude, latitude]` order. The origin and destination are stops. Set `stopover: false` on an intermediate point to pass through without ending a leg or announcing arrival. When starting at the user's position, the origin can include `heading` (degrees clockwise from true north) and `speed` (meters per second). Zero means north or stationary, respectively; `null` means unknown. | | `language?` | `string \| undefined` | One Intl locale identifier, such as `fr-CA`. For unsupported languages, guidance falls back to `en-US`. | | `schedule?` | `{ depart: string; arrive?: never; } \| { arrive: string; depart?: never; } \| undefined` | Set either `depart` or `arrive` to an ISO 8601 timestamp, not both. Omit to depart now. | | `mode?` | `"BICYCLE" \| "DRIVE" \| "TRANSIT" \| "WALK" \| undefined` | How to travel between stops. Defaults to driving. See [TravelMode](/api/travel-mode). | | `preferences?` | `DrivingPreferences \| WalkingOrCyclingPreferences \| undefined` | Driving accepts a [RouteObjective](/api/route-objective) and [AvoidFeature](/api/avoid-feature) values. Walking and cycling accept avoids only; transit takes no preferences. | ## Example [#example] Plan a drive from Denver to Boulder that favors travel time and avoids toll roads where possible: ```ts import { AvoidFeature, RouteObjective, TravelMode, type Itinerary } from '@mapquest/sdk' const itinerary: Itinerary = { waypoints: [ { coordinates: [-104.9903, 39.7392], name: 'Denver' }, { coordinates: [-105.2705, 40.0150], name: 'Boulder' }, ], mode: TravelMode.DRIVE, preferences: { objective: RouteObjective.FASTEST, avoids: [AvoidFeature.TOLL_ROAD], }, } ``` # RouteObjective [#routeobjective] ```ts const preferences = { objective: RouteObjective.SHORTEST } ``` Set [`itinerary.preferences.objective`](/api/itinerary) to choose what to prioritize for a driving route. ## Values [#values] | Value | Description | | ------------------------- | -------------------------------------- | | `RouteObjective.FASTEST` | Favor a shorter estimated travel time. | | `RouteObjective.SHORTEST` | Favor a shorter driving distance. | # TravelMode [#travelmode] ```ts const itinerary = { ...trip, mode: TravelMode.DRIVE } ``` Set [`itinerary.mode`](/api/itinerary) to choose how to travel between stops. Driving is the default. ## Values [#values] | Value | Description | | -------------------- | ------------------------- | | `TravelMode.DRIVE` | Travel by car. | | `TravelMode.WALK` | Travel on foot. | | `TravelMode.BICYCLE` | Travel by bicycle. | | `TravelMode.TRANSIT` | Travel by public transit. | # MapQuest SDK for Expo [#mapquest-sdk-for-expo] Add a map, search for places, or guide someone along a route in your iOS or Android app. **[Show your first map →](/quickstart)** ## Integration guides [#integration-guides] - [Maps and location](/maps): Choose a map style and request permission to use the device's location. - [Place search](/hooks/use-search-suggestions): Connect an autocomplete input to ranked suggestions. - [Turn-by-turn navigation](/navigation): Compare routes, start guidance, and share a trip across screens. ## Hello Agents! [#hello-agents] Browse the [Markdown index](/llms.txt) for individual guides and hook references, or read the [complete documentation in one file](/llms-full.txt). # Maps and location [#maps-and-location] Once you can [show a map](/quickstart), give it a starting point. A map of a destination needs no location permission; ask for location only if the user wants the map to follow them. For additional map and camera props, see the MapLibre React Native references for [Map](https://maplibre.org/maplibre-react-native/docs/components/map/#props) and [Camera](https://maplibre.org/maplibre-react-native/docs/components/camera/). ## Open the map on a place [#open-the-map-on-a-place] `Map` draws the map while `Camera` controls which part of it is visible. Add `Camera` as a child of `Map` and give it a center in `[longitude, latitude]` order. This screen opens on downtown Denver: ```tsx import { Camera } from '@mapquest/expo-maplibre' import { Map } from '@mapquest/sdk' export default function MapScreen() { return ( ) } ``` Increase `zoom` to see individual streets, or decrease it to show more of the city. To show a different destination, change `center`. ## Choose a map style [#choose-a-map-style] By default the map follows the app's light or dark appearance. To follow the device setting on iOS, set `ios.userInterfaceStyle` to `'automatic'` in your Expo config. To use a fixed map style, set the `theme` prop to one of the following themes: | Value | Description | | -------------------- | ---------------------------------------------------------------------- | | `MapTheme.LIGHT` | A light street map for daytime use or a light app theme. | | `MapTheme.DARK` | A dark street map for low-light settings or a dark app theme. | | `MapTheme.SATELLITE` | Satellite imagery with road outlines and street names overlaid. | | `MapTheme.GRAYSCALE` | A street map with muted colors that help routes and markers stand out. | # Turn-by-turn navigation [#turn-by-turn-navigation] Render `` on the screen where the user follows a route. It provides the guidance map and follow camera. Leaving that screen doesn't end the trip. ## Share a trip across screens [#share-a-trip-across-screens] If one screen plans a trip and another displays guidance, place `Navigation.Provider` above both. Mounting the provider does not calculate a route or start location updates. ```tsx import { Navigation } from '@mapquest/sdk' import { Stack } from 'expo-router' export default function TripLayout() { return ( ) } ``` ## Start or end a trip [#start-or-end-a-trip] Inside the provider, use [`useNavigation()`](/hooks/use-navigation) for commands and [`useNavigationSession()`](/hooks/use-navigation-session) to decide which button to show: ```tsx import { type Itinerary, useNavigation, useNavigationSession } from '@mapquest/sdk' import { Button } from 'react-native' function TripButton({ itinerary }: { itinerary: Itinerary }) { const navigation = useNavigation() const session = useNavigationSession() return session ?