import { useState } from "react" import { MapContainer, TileLayer, Marker, Popup, useMapEvents, useMap } from 'react-leaflet' const NZ_BOUNDS = [ [-47.204642, 165.344238], [-34.307144, 179.824219] ] function LocationMarker(props) { const [position, setPosition] = useState(null) useMapEvents({ click(e) { const newPosition = e.latlng; setPosition(newPosition); props.updateFilterState({"latitude": newPosition.lat, "longitude": newPosition.lng}); props.setNextDisabled(false); }, }) return position === null ? null : ( Latitude: {position.lat}
Longitude: {position.lng}
) } function FitNewZealandBounds() { const map = useMap() map.fitBounds(NZ_BOUNDS) return null } export default function Map(props) { return (
) }