Add PropertyMap and PriceMarker components with property search functionality

This commit is contained in:
2026-01-31 23:22:12 +05:30
parent 5b04cc9a58
commit b9cae949d4
6 changed files with 380 additions and 20 deletions

View File

@@ -1,32 +1,43 @@
import React, { useRef } from 'react';
import React, { useRef, useState } from 'react';
import { SafeAreaView, StyleSheet, Button, View } from 'react-native';
import { MapView, Marker } from '@lynkedup/map-sdk';
import { MapView, Marker, PropertyMap } from '@lynkedup/map-sdk';
import type { MapHandle } from '@lynkedup/map-sdk';
export default function App() {
const mapRef = useRef<MapHandle | null>(null);
const [showPropertyMap, setShowPropertyMap] = useState(false);
return (
<SafeAreaView style={styles.container}>
<View style={styles.controls}>
<Button
title="Fly to SF"
onPress={() => mapRef.current?.flyTo({ latitude: 37.78825, longitude: -122.4324 })}
/>
<Button
title="Fit Bounds"
onPress={() =>
mapRef.current?.fitBounds({ latitude: 37.809, longitude: -122.410 }, { latitude: 37.779, longitude: -122.450 })
}
/>
<Button title="Toggle SDK Example" onPress={() => setShowPropertyMap((s) => !s)} />
{!showPropertyMap && (
<View style={{ flexDirection: 'row' }}>
<Button
title="Fly to SF"
onPress={() => mapRef.current?.flyTo({ latitude: 37.78825, longitude: -122.4324 })}
/>
<Button
title="Fit Bounds"
onPress={() =>
mapRef.current?.fitBounds({ latitude: 37.809, longitude: -122.410 }, { latitude: 37.779, longitude: -122.450 })
}
/>
</View>
)}
</View>
<MapView
ref={mapRef}
style={styles.map}
initialRegion={{ latitude: 37.78825, longitude: -122.4324, latitudeDelta: 0.0922, longitudeDelta: 0.0421 }}
>
<Marker coordinate={{ latitude: 37.78825, longitude: -122.4324 }} />
</MapView>
{showPropertyMap ? (
<PropertyMap apiUrl="http://64.227.108.180:5000/property-search" />
) : (
<MapView
ref={mapRef}
style={styles.map}
initialRegion={{ latitude: 37.78825, longitude: -122.4324, latitudeDelta: 0.0922, longitudeDelta: 0.0421 }}
>
<Marker coordinate={{ latitude: 37.78825, longitude: -122.4324 }} />
</MapView>
)}
</SafeAreaView>
);
}