# bramus/react-native-maps-directions architecture

> Architecture diagram of the GitHub repository bramus/react-native-maps-directions, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-30). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/bramus/react-native-maps-directions
- Repository: https://github.com/bramus/react-native-maps-directions

## Overview

This is a small React Native map component that fetches directions and renders the resulting route. A consumer supplies endpoints and an API key; the component prepares one or more requests, fetches and decodes route data, then renders a polyline and reports start, success, or failure through callbacks. Route splitting, waypoint optimization, travel mode, localization, traffic timing, and precision are options within that workflow. The implementation is concentrated in one source file; the graph separates its responsibilities for clarity.

Main entry points: [`src/MapViewDirections.js`](https://github.com/bramus/react-native-maps-directions/blob/master/src/MapViewDirections.js) (Directions Component)

## Diagram (Mermaid)

```mermaid
flowchart TD

node_consumer(("Map Consumer"))
node_component["Directions Component"]
node_routing["Route Orchestration"]
node_transport["Request and Decode"]
node_directions_api["Directions API"]
node_polyline["Map Polyline"]

node_consumer -->|"supplies route props"| node_component
node_component -->|"starts route"| node_routing
node_routing -->|"requests routes"| node_transport
node_transport -->|"fetches directions"| node_directions_api
node_directions_api -->|"returns JSON"| node_transport
node_component -->|"renders route"| node_polyline
node_routing -->|"reports callbacks"| node_consumer

click node_component "https://github.com/bramus/react-native-maps-directions/blob/master/src/MapViewDirections.js"
click node_routing "https://github.com/bramus/react-native-maps-directions/blob/master/src/MapViewDirections.js"
click node_transport "https://github.com/bramus/react-native-maps-directions/blob/master/src/MapViewDirections.js"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_consumer,node_polyline toneIndigo
class node_component toneTeal
class node_routing,node_transport,node_directions_api toneMint
```

## Components

### Other components

- **Map Consumer**
- [Directions Component](https://github.com/bramus/react-native-maps-directions/blob/master/src/MapViewDirections.js): `src/MapViewDirections.js`
- [Route Orchestration](https://github.com/bramus/react-native-maps-directions/blob/master/src/MapViewDirections.js): `src/MapViewDirections.js`
- [Request and Decode](https://github.com/bramus/react-native-maps-directions/blob/master/src/MapViewDirections.js): `src/MapViewDirections.js`
- **Directions API**
- **Map Polyline**

## Connections

- Map Consumer → Directions Component: supplies route props (evidence: `README.md`)
- Directions Component → Route Orchestration: starts route (evidence: `src/MapViewDirections.js`)
- Route Orchestration → Request and Decode: requests routes (evidence: `src/MapViewDirections.js`)
- Request and Decode → Directions API: fetches directions (evidence: `src/MapViewDirections.js`)
- Directions API → Request and Decode: returns JSON (evidence: `src/MapViewDirections.js`)
- Directions Component → Map Polyline: renders route (evidence: `src/MapViewDirections.js`)
- Route Orchestration → Map Consumer: reports callbacks (evidence: `src/MapViewDirections.js`)
