leaflet-geosearch
leaflet-geosearch copied to clipboard
Clicking on Map Address Suggestions returns error
Isse Description: When start typing on the Search box and try to select an entry from the list of suggestions that shows an uncaught reference is logged in the console and the marker is not moved.
import React, { useEffect } from "react";
import { useMap } from "react-leaflet";
import { GeoSearchControl, OpenStreetMapProvider } from "leaflet-geosearch";
import "leaflet-geosearch/dist/geosearch.css";
const SearchBox: React.FC = () => {
const map = useMap();
useEffect(() => {
const provider = new OpenStreetMapProvider();
//const provider = customProvider;
//@ts-ignore
const searchControl = new GeoSearchControl({
provider,
showMarker: true,
autoClose: false,
notFoundMessage: "Sorry! The entered item is not found."
});
map.addControl(searchControl);
return () => {
map.removeControl(searchControl);
};
}, [map]);
return null;
};
export default SearchBox;
Error:
Hi, the error is due to the version of 3.10.0 (latest). To resolve it quickly until the latest got fixed, you can downgrade to the version of 3.9.0
@abumuawiyah Hello, I can see the same issue with version 3.9.0, downgrading to 3.8.0 solved this issue.
Also see #384
works for me after downgrading to 3.9.0
Yes, the error has been introduced in v3.10.0 through the addition of validateCoords().