Skip to main content

React Native

Fetch Example

const getRoute = async () => {
const res = await fetch(
'https://map.arohon.co/v1/route?origin=23.81,90.41&destination=23.75,90.37&vehicle_type=car',
{
headers: { 'Authorization': `Bearer ${apiKey}` }
}
);
const data = await res.json();
return data;
};

Axios Example

import axios from 'axios';

const api = axios.create({
baseURL: 'https://map.arohon.co',
headers: { 'Authorization': `Bearer ${apiKey}` }
});

const route = await api.get('/v1/route', {
params: { origin: '23.81,90.41', destination: '23.75,90.37', vehicle_type: 'car' }
});

Map Display

Use @rnmapbox/maps or react-native-maplibre with vector tiles. Add the API key via transformRequest or a custom tile source.

Security

Store the API key securely (e.g. react-native-keychain). Never commit it to source control.