Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clicking on Map Address Suggestions returns error #378

Open
sumibane opened this issue Oct 7, 2023 · 5 comments
Open

Clicking on Map Address Suggestions returns error #378

sumibane opened this issue Oct 7, 2023 · 5 comments

Comments

@sumibane
Copy link

sumibane commented Oct 7, 2023

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:
Screenshot 2023-10-08 015550

@abumuawiyah
Copy link

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

@Hossam-Ali
Copy link

@abumuawiyah Hello, I can see the same issue with version 3.9.0, downgrading to 3.8.0 solved this issue.

@gjvoosten
Copy link
Contributor

gjvoosten commented Oct 11, 2023

Also see #384

@TekTimmy
Copy link

works for me after downgrading to 3.9.0

@gjvoosten
Copy link
Contributor

Yes, the error has been introduced in v3.10.0 through the addition of validateCoords().

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants