back icon in new address

This commit is contained in:
hamid zarghami
2025-12-25 11:14:00 +03:30
parent 0f2f0d5c29
commit e438d35b48
2 changed files with 125 additions and 8 deletions
+9
View File
@@ -28,6 +28,7 @@ interface CustomMapProps {
onClick?: (event: L.LeafletMouseEvent) => void;
searchEnabled?: boolean
markerActive?: boolean
onMapReady?: (map: L.Map) => void;
}
// Component to handle map events and position updates
@@ -114,6 +115,7 @@ const CustomMap: React.FC<CustomMapProps> = ({
onClick,
markerActive = true,
searchEnabled = true,
onMapReady,
}) => {
const [selectedPosition, setSelectedPosition] = useState<[number, number] | null>(null);
const [mapInstance, setMapInstance] = useState<L.Map | null>(null);
@@ -136,6 +138,13 @@ const CustomMap: React.FC<CustomMapProps> = ({
checkTiles();
}, [mapInstance]);
// Notify parent when map is ready
useEffect(() => {
if (mapInstance && onMapReady) {
onMapReady(mapInstance);
}
}, [mapInstance, onMapReady]);
// Initialize default icon on client side only
useEffect(() => {
// Dynamic import of Leaflet on the client side