Overview
Complete reference for all props accepted by theMapViewRoute component. Props are organized by category for easy navigation.
Required Props
These props must be provided for the component to function.Starting point of the route.Must be a
react-native-maps LatLng object with latitude and longitude properties.Ending point of the route.Must be a
react-native-maps LatLng object with latitude and longitude properties.Your Google Maps API key with the Routes API enabled.Get your API key from the Google Cloud Console and ensure the Routes API is enabled for your project.
Routing Configuration
Props that control route calculation and path finding.Array of intermediate points the route should pass through.The route will be calculated to pass through these waypoints in order from origin to destination.Default:
[]Travel mode for route calculation.Available modes:Default:
"DRIVE"- Driving by car"BICYCLE"- Bicycle routing"TWO_WHEELER"- Motorcycle or scooter"WALK"- Walking/pedestrian routing
"WALK"See TravelMode type for more details.Options to modify route calculation such as avoiding tolls, highways, or ferries.Available options:
avoidTolls- Avoid toll roads (DRIVE, TWO_WHEELER only)avoidHighways- Avoid highways (DRIVE, TWO_WHEELER only)avoidFerries- Avoid ferries (DRIVE, TWO_WHEELER only)avoidIndoor- Avoid indoor steps (WALK only)
Override or add any field to the request body sent to Google Routes API.Applied after built-in fields (origin, destination, travelMode, routeModifiers). Use this to access advanced API features like traffic awareness, language preferences, or polyline quality.Reference: Google Routes API computeRoutes
Styling Props
Props that control the visual appearance of the route line.Color of the route line.Accepts any valid color format: hex, rgb, rgba, or named colors.Default:
"#000"Width of the route line in pixels.Default:
6How line segments are joined together.Available values:Default:
"round"- Rounded corners"bevel"- Beveled corners"miter"- Sharp corners
"round"How the ends of the line are drawn.Available values:Default:
"round"- Rounded ends"butt"- Flat ends"square"- Square ends
"round"Data Options
Props that control what additional data is fetched and made available through callbacks.Enable calculation and callback of estimated travel time.When Default:
true, the onEstimatedTime callback will be called with the estimated duration in milliseconds.falseNote: Must be set to true for onEstimatedTime callback to fire.Enable calculation and callback of route distance.When Default:
true, the onDistance callback will be called with the total distance in meters.falseNote: Must be set to true for onDistance callback to fire.Array of leg fields to request from the Google Routes API.A leg represents a segment of the route between waypoints. Specify which fields you want returned for each leg.Available fields:Note: Required (along with
"distanceMeters"- Distance in meters"duration"- Duration with traffic"staticDuration"- Duration without traffic"startLocation"- Start coordinates"endLocation"- End coordinates
legStepFields) for onLegs callback to fire.See LegField type for more details.Array of leg step fields to request from the API.Steps provide turn-by-turn navigation instructions within each leg. Specify which fields you want returned for each step.Available fields:Note: Enables detailed step data in the
"distanceMeters"- Distance in meters"staticDuration"- Duration"polyline"- Encoded polyline for the step"startLocation"- Start coordinates"endLocation"- End coordinates"navigationInstruction"- Turn-by-turn instructions
onLegs callback.See LegStepField type for more details.Callback Props
Event handler functions called at various points in the route lifecycle. For detailed documentation of each callback, see the Callbacks page.Called when the route has been successfully fetched and is ready to render.Receives an array of decoded coordinates that make up the route polyline.See onReady callback for details.
Called when an error occurs during route fetching.Receives an Error object describing what went wrong.See onError callback for details.
Called with the estimated travel time in milliseconds.Requires:
enableEstimatedTime={true}See onEstimatedTime callback for details.Called with the total route distance in meters.Requires:
enableDistance={true}See onDistance callback for details.Called with detailed information about each route leg and step.Requires:
legFields and/or legStepFields to be specifiedSee onLegs callback for details.Complete Example
See Also
- MapViewRoute Component - Component overview
- Callbacks Reference - Detailed callback documentation
- Types Reference - TypeScript type definitions