react-leaflet-search icon indicating copy to clipboard operation
react-leaflet-search copied to clipboard

React Leaflet V3

Open abewartech opened this issue 4 years ago • 11 comments

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

abewartech avatar Nov 06 '20 06:11 abewartech

Any news about V3 integration?

debonx avatar Nov 14 '20 15:11 debonx

+1

AndrejGajdos avatar Feb 10 '21 10:02 AndrejGajdos

+1

tnanhpt avatar Feb 23 '21 10:02 tnanhpt

+1

dtropp avatar Mar 08 '21 07:03 dtropp

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

mrShahsafi avatar Apr 04 '21 16:04 mrShahsafi

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...

matburnham avatar Apr 11 '21 20:04 matburnham

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

pranav-ted avatar Jun 14 '21 18:06 pranav-ted

thanks @pranav-ted

mrShahsafi avatar Jun 15 '21 07:06 mrShahsafi

thanks @pranav-ted

Gabriel-Almeida-Ajax avatar Jul 16 '21 18:07 Gabriel-Almeida-Ajax

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.

SalahAdDin avatar Jun 17 '22 17:06 SalahAdDin

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)

socketopp avatar Sep 13 '22 17:09 socketopp