Skip to content
Developer documentation

React Native

React Native 0.88.x with React 19.3+

React Native

React Native 0.88.x with React 19.3+

A mobile client that never holds an organization key. It requires a proxyBaseUrl pointing at your own backend, which attaches the real credential, so the pattern is enforced by the API surface rather than by a warning.

Install

npm
npm install @bardiyamap/react-native@0.1.0

What it supports

  • Maps and tracking calls through your proxy
  • BardiyaMap map component with routes and markers
  • Realtime subscription handling
  • Pluggable fetch so your app session can add its own auth

Initialise the client

ts
import { createMobileClient } from "@bardiyamap/react-native";

const client = createMobileClient({
  proxyBaseUrl: "https://YOUR-BACKEND.example/bardiya",
  fetch: async (url, init) => {
    const headers = new Headers(init?.headers);
    headers.set("Authorization", `Bearer ${await yourAppSession()}`);
    return fetch(url, { ...init, headers });
  },
});

Typical operations

Calls through your proxy

ts
const places = await client.maps.places.search({ q: "coffee", limit: 5 });
const address = await client.maps.geocoding.forward({ address: "Talaat Harb Cairo" });
const route = await client.maps.routing.directions({
  origin: { longitude: 31.2357, latitude: 30.0444 },
  destination: { longitude: 31.2497, latitude: 30.0626 },
});

Map component

tsx
import { BardiyaMap } from "@bardiyamap/react-native/map";

const style = await client.maps.style(); // your backend returns proxied source URLs

<BardiyaMap
  mapStyle={style}
  style={{ flex: 1 }}
  route={{ coordinates: [[31.2357, 30.0444], [31.3209, 30.0626]] }}
  markers={[{ id: "cairo", longitude: 31.2357, latitude: 30.0444 }]}
/>;

Things that catch people out

  • Your proxy must forward to api.bardiyamap.com and must not echo the organization key back to the device.
  • The package version 0.1.0 is published on npm; earlier drafts describing it as unreleased are obsolete.