slutske22 / react-esri-leaflet

react components for esri-leaflet
https://codesandbox.io/s/github/slutske22/react-esri-leaflet/tree/master/examples/ts
MIT License
37 stars 5 forks source link

Add support to new flag ignoreDeprecationWarning from esri-leaflet > v3.0.2 #14

Closed alessandro-lenzi closed 2 years ago

alessandro-lenzi commented 2 years ago

Added a deprecation warning when using L.esri.BasemapLayer (info). This warning can be disabled by setting the ignoreDeprecationWarning option to true. (https://github.com/Esri/esri-leaflet/pull/1293).

I think it would be interesting to forward that flag on react-esri-leaflet.

slutske22 commented 2 years ago

I haven't had a chance to see what's new in the new patch of esri-leaflet or esri-leaflet-geocoder, or how its going to affect this wrapper. I'll take a look when I get a chance.

alessandro-lenzi commented 2 years ago

Thank you @slutske22

slutske22 commented 2 years ago

This is implemented in version 2, which is currently in a @next version. You can try it out here: https://www.npmjs.com/package/react-esri-leaflet/v/2.0.0, npm i react-esri-leaflet@next, Will publish as official version soon.

bobmoretti commented 2 years ago

Sorry for the dumb question, but how do I use this option? I'm using react-esri-leaflet version 2.0.1.

Inside a MapContainer my code instantiates a BasemapLayer as follows

<BasemapLayer key={mapType} name={mapType}  />
slutske22 commented 2 years ago

Sorry for the dumb question, but how do I use this option? I'm using react-esri-leaflet version 2.0.1.

Inside a MapContainer my code instantiates a BasemapLayer as follows

<BasemapLayer key={mapType} name={mapType}  />

That code should work fine...is there an issue? It should just give you fancy intellisense for the fact that the underlying L.esri.basemapLayer is deprecated.

bobmoretti commented 2 years ago

Sorry, I did a poor job of explaining my question.

How do I enable the ignoreDeprecationWarning option that is in esri-leaflet? Is it a prop for BasemapLayer? If so, I can't get it to work.

slutske22 commented 2 years ago

Sorry, I did a poor job of explaining my question.

How do I enable the ignoreDeprecationWarning option that is in esri-leaflet? Is it a prop for BasemapLayer? If so, I can't get it to work.

Passing it as a prop should work:

        <BasemapLayer
          ref={basemapLayerRef}
          name="DarkGray"
          // @ts-expect-error
          ignoreDeprecationWarning
        />

When I pass this prop in, the deprecation warning stops showing up in the console. If you are using typescript, you'll see that ignoreDeprecationWarning is not officially a prop. This is because @types/esri-leaflet (currently v 2.1.9) has not added it as an official prop, at least yet:

Screen Shot 2022-06-13 at 5 00 37 AM

This just means that @types/esri-leaflet is not up to date with esri-leaflet. Passing this as a prop seems to work fine for me. What issue are you having?

bobmoretti commented 2 years ago

Sorry, that was the piece I was missing.

This is my lack of familiarity with React... I had the mistaken impression that props were always key/value pairs. I tried ignoreDeprecationWarning={true} and many other variations thereof to no avail.

Thanks so much for your help.