Skip to main content

Arrow

The Arrow component draws a directional arrow along a path of geographic coordinates. Useful for indicating route directions or movement. Must be rendered as a child of <Map>.

Import

import { Arrow } from 'react-native-here-explore';
import type { ArrowProps } from 'react-native-here-explore';

Usage

Basic arrow

<Map mapScheme="NORMAL_DAY" geoCoordinates={{ latitude: 48.85, longitude: 2.35 }} zoomValue={13}>
<Arrow
geoPolyline={[
{ latitude: 48.84, longitude: 2.33 },
{ latitude: 48.85, longitude: 2.35 },
{ latitude: 48.86, longitude: 2.38 },
]}
lineColor="#E91E63"
lineWidth={10}
/>
</Map>

Route arrow with routing hook

import { useRouting, Arrow, Map } from 'react-native-here-explore';

function RouteMap() {
const { route, calculate } = useRouting({
waypoints: [
{ latitude: 48.84, longitude: 2.33 },
{ latitude: 48.87, longitude: 2.40 },
],
routeOption: 'CarOptions',
});

return (
<Map mapScheme="NORMAL_DAY" geoCoordinates={{ latitude: 48.85, longitude: 2.35 }} zoomValue={12}>
{route && (
<Arrow
geoPolyline={route.vertices}
lineColor="#1A73E8"
lineWidth={8}
/>
)}
</Map>
);
}

Props

PropTypeRequiredDefaultDescription
geoPolylineGeoPolylineYesArray of coordinates defining the arrow path. Minimum 2 points required
lineColorColorValueNoColor of the arrow. Accepts named colors, hex, or rgba
lineWidthnumberNoWidth/thickness of the arrow

Color formats

"blue"                    // named color
"#1A73E8" // hex
"rgba(26, 115, 232, 0.9)" // rgba

Difference from Polyline

FeatureArrowPolyline
ArrowheadYesNo
Line styleSolid onlySolid or Dashed
OutlineNoYes (solid mode)
Cap shapeConfigurable

Use Arrow when you need to visually indicate direction. Use Polyline for general-purpose lines without arrowheads.