Skip to main content

Map

The Map component is the core of the library. It renders an interactive HERE map and acts as the container for all other map elements (Marker, Polyline, Polygon, Arrow).

Import

import { Map } from 'react-native-here-explore';
import type { MapProps } from 'react-native-here-explore';

Usage

Map requires either geoCoordinates or geoBox — not both.

Center on coordinates

<Map
mapScheme="NORMAL_DAY"
zoomValue={12}
geoCoordinates={{ latitude: 48.8566, longitude: 2.3522 }}
/>

Fit a bounding box

<Map
mapScheme="HYBRID_DAY"
geoBox={{
southWestCorner: { latitude: 33.819096, longitude: -7.320056 },
northEastCorner: { latitude: 34.460004, longitude: -6.121828 },
}}
/>

With children

<Map
mapScheme="NORMAL_NIGHT"
zoomValue={14}
geoCoordinates={{ latitude: 48.8566, longitude: 2.3522 }}
>
<Marker
geoCoordinates={{ latitude: 48.8566, longitude: 2.3522 }}
image={require('./assets/pin.png')}
/>
</Map>

Props

Common props (both modes)

PropTypeRequiredDefaultDescription
mapSchemeMapSchemeYesVisual style of the map
bearingnumberNo0Rotation in degrees (0–360)
tiltnumberNo03D tilt angle (0–70). Some cities show 3D buildings when supported
watermarkStyle'DARK' | 'LIGHT'NoColor of the HERE watermark logo
onMapTapfunctionNoFired on a single tap. Receives { latitude, longitude, altitude }
onMapLongPressfunctionNoFired on a long press. Receives { latitude, longitude, altitude }
styleStyleProp<ViewStyle>No{ flex: 1 }React Native view style

Via geoCoordinates

PropTypeRequiredDefaultDescription
geoCoordinatesGeoCoordinatesYesMap center point
zoomValuenumberNo8.0Zoom level. Higher values zoom in closer
zoomKindZoomKindNo'ZOOM_LEVEL'How to interpret zoomValue

Via geoBox

PropTypeRequiredDefaultDescription
geoBoxGeoBoxYesBounding box with southWestCorner and northEastCorner
rectangle2DRectangle2DNoOptional pixel rectangle for rendering area

Events

onMapTap

<Map
geoCoordinates={{ latitude: 48.8566, longitude: 2.3522 }}
mapScheme="NORMAL_DAY"
onMapTap={({ nativeEvent }) => {
console.log(nativeEvent.latitude, nativeEvent.longitude);
}}
/>

onMapLongPress

<Map
geoCoordinates={{ latitude: 48.8566, longitude: 2.3522 }}
mapScheme="NORMAL_DAY"
onMapLongPress={({ nativeEvent }) => {
console.log('Long pressed at:', nativeEvent.latitude, nativeEvent.longitude);
}}
/>

MapScheme

Controls the visual style of the map.

ValueDescription
'NORMAL_DAY'Standard street map, light theme
'NORMAL_NIGHT'Standard street map, dark theme
'SATELLITE'Satellite imagery only
'HYBRID_DAY'Satellite imagery with street labels, light
'HYBRID_NIGHT'Satellite imagery with street labels, dark
'LITE_DAY'Simplified street map, light
'LITE_NIGHT'Simplified street map, dark
'LITE_HYBRID_DAY'Simplified hybrid, light
'LITE_HYBRID_NIGHT'Simplified hybrid, dark
'LOGISTICS_DAY'Optimized for logistics/fleet use cases

ZoomKind

Controls how the zoomValue is interpreted.

ValueDescription
'ZOOM_LEVEL'Standard zoom level (default). Higher = closer
'DISTANCE'Distance from camera to target in meters
'SCALE'Map scale ratio
tip

Leave zoomKind as the default 'ZOOM_LEVEL' unless you have a specific need for distance- or scale-based zoom.