alex3165 / react-leaflet-draw

React component for leaflet-draw on top of react-leaflet
228 stars 152 forks source link

No context provided: descendant of <MapContainer> #97

Closed nalliot closed 3 years ago

nalliot commented 3 years ago

Hello

I think the release 0.19.7 should be 0.20 because it is breaking compatibility with react-leaflet 2.7. For compatibility reason I have to user this old version of react leaflet.

With the latest release, react leaflet core is required and is only compatible with more recent version of react-leaflet that exposes MapContainer.

Error message is : No context provided: useLeafletContext() can only be used in a descendant of

Fixed by forcing 0.19.0 version.

This should be a major version, because with this rule : "react-leaflet-draw": "^0.19.0" , leaflet-draw is broken.

Thank you for the lib which is very useful !

srghma commented 3 years ago

tnx, my bad, I didn't test anything, because I'm not using this lib

it's probably late to change version, please reopen this issue if this is not right

also, should I use version number 0.20 for next commit? Not clear too

nalliot commented 3 years ago

Np ! Perfectly fine if it is closed now. Some people might find this issue useful if they have the same problem. I think it is too late since the release is done.

And I perfectly understand you cannot test all the cases and libraries to know if it is a breaking version that should not be minor but major since npm handles the minor with specific rules.

snowmous3 commented 3 years ago

@nalliot did you have a problem 'useLeafletContext()' with version "^0.19.7" and the solution with "0.19.0"? But, what version leaflet-draw did you use with the version "0.19.0"?