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

React Leaflet V3 #40

Open
abewartech opened this issue Nov 6, 2020 · 11 comments
Open

React Leaflet V3 #40

abewartech opened this issue Nov 6, 2020 · 11 comments

Comments

@abewartech
Copy link

Uncaught TypeError: Class extends value undefined is not a constructor or null
at Module../node_modules/react-leaflet-search/lib/ReactLeafletSearch.js

@debonx
Copy link

debonx commented Nov 14, 2020

Any news about V3 integration?

@AndrejGajdos
Copy link

+1

2 similar comments
@tnanhpt
Copy link

tnanhpt commented Feb 23, 2021

+1

@dtropp
Copy link

dtropp commented Mar 8, 2021

+1

@mrShahsafi
Copy link

'MapControl' is not exported from 'react-leaflet'.

@matburnham
Copy link

I started looking into this, but it's not as trivial as I first thought.

It looks like the new way of doing things is that react-leaflet-search needs to be a Child component. Child components can only be used as descendants of a MapContainer component. As-in, a descendant in HTML tag terms, not inheritance.

So, one could inherit from a Component rather than a MapControl. But then you need to get access to the Leaflet map object, which seems to be via a useRef hook (https://react-leaflet.js.org/docs/api-components#referenceable-behavior) unless there's another way. You'd also need to reimplement the (small amount of) location logic in the original MapControl class.

There's likely a bit more to it than that, so I'm parking this for my use-case for now, as I've ended up six levels deep trying to fix a different issue...

@pranav-ted
Copy link

https://codesandbox.io/s/search-box-implementation-in-react-leaflet-v310-forked-ouezc?file=/src/MapWrapper.jsx

@mrShahsafi
Copy link

thanks @pranav-ted

1 similar comment
@Gabriel-Almeida-Ajax
Copy link

thanks @pranav-ted

@SalahAdDin
Copy link

https://codesandbox.io/s/search-box-implementation-in-react-leaflet-v310-forked-ouezc?file=/src/MapWrapper.jsx

It does not include all the options we have here and it also is weak on types.

@socketopp
Copy link

Any progress on this?

export 'MapControl' (imported as 'MapControl') was not found in 'react-leaflet' (possible exports: AttributionControl, Circle, CircleMarker, FeatureGroup, GeoJSON, ImageOverlay, LayerGroup, LayersControl, MapContainer, Marker, Pane, Polygon, Polyline, Popup, Rectangle, SVGOverlay, ScaleControl, TileLayer, Tooltip, VideoOverlay, WMSTileLayer, ZoomControl, useMap, useMapEvent, useMapEvents)

ERROR in ./node_modules/react-leaflet-search/lib/Search-v2.js 3:15-26
export 'withLeaflet' (imported as 'withLeaflet') was not found in 'react-leaflet' (possible exports: AttributionControl, Circle, CircleMarker, FeatureGroup, GeoJSON, ImageOverlay, LayerGroup, LayersControl, MapContainer, Marker, Pane, Polygon, Polyline, Popup, Rectangle, SVGOverlay, ScaleControl, TileLayer, Tooltip, VideoOverlay, WMSTileLayer, ZoomControl, useMap, useMapEvent, useMapEvents)

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