Enhance documentation and type definitions for location tracking and property components

This commit is contained in:
2026-02-04 23:36:51 +05:30
parent d1e383baf5
commit 986266348a
5 changed files with 163 additions and 98 deletions

View File

@@ -18,7 +18,7 @@ import React from 'react';
import { MapView, Marker, useLocationTracking, Polyline } from '@lynkedup/map-sdk';
export default function App() {
const { isTracking, path, startTracking, stopTracking, clear } = useLocationTracking();
const { isTracking, path, startTracking, stopTracking, clear } = useLocationTracking(/* opts?: TrackingOptions, geolocation?: GeolocationAPI */);
return (
<MapView style={{ flex: 1 }} initialRegion={{ latitude: 37.78825, longitude: -122.4324, latitudeDelta: 0.0922, longitudeDelta: 0.0421 }}>
@@ -27,6 +27,8 @@ export default function App() {
</MapView>
);
}
> Tip: `useLocationTracking()` accepts an optional `TrackingOptions` object and an optional `GeolocationAPI` (handy for testing with a mocked geolocation provider). Ensure you request platform location permissions before starting tracking.
```
Tracking notes:
@@ -103,11 +105,14 @@ export default function PropertiesScreen() {
Props summary:
- `apiUrl?: string` — POST endpoint used for property searches (defaults to the demo host).
- `initialRegion?: Region` — starting region.
- `radius?: number` — search radius in meters (default: 500).
- `showSearch?: boolean` — render search bar (default: true).
- `onSelectProperty?: (item) => void` — callback for property selection.
| Prop | Type | Default | Description |
| ---- | ---- | ------- | ----------- |
| `apiUrl` | `string` | demo host | POST endpoint used for property searches. Should accept `{ location, radius }` and return `{ success, properties, location }`.
| `initialRegion` | `Region` | `DEFAULT_REGION` | Starting region for the map.
| `radius` | `number` | `500` | Search radius in meters.
| `showSearch` | `boolean` | `true` | Show or hide the built-in search bar.
| `onSelectProperty` | `(item: PropertyItem) => void` | — | Callback invoked when a property is selected.
| `mapProps` | `Partial<RNMapViewProps>` | — | Props forwarded to the underlying `react-native-maps` view (e.g., `mapType`, `showsMyLocationButton`).
---