alex3165 / react-leaflet-draw

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

Error: No context provided: useLeafletContext() can only be used in a descendant of <MapContainer> #171

Closed MistreanuIonutCosmin closed 1 year ago

MistreanuIonutCosmin commented 1 year ago

Issue Describe the issue

I am trying to use the latest packages for leaflet, leaflet-draw, react-leaflet and react-leaflet-draw, but I am getting the error "Error: No context provided: useLeafletContext() can only be used in a descendant of ". Everything works fine if I downgrade react-leaflet to version "^3.2.5".

Expected behavior

I expect the code to work with the latest packages without any errors.

Packages used "leaflet": "^1.9.3", "leaflet-draw": "^1.0.4", "react-leaflet": "^4.2.0", "react-leaflet-draw": "^0.20.4", Additional context

I appreciate your awesome repository. I would be grateful if you could suggest a solution for this issue.

giovanesantossilva commented 1 year ago

Hello, I would like to suggest trying to use the plugin that I developed in order to solve these and other problems, to learn more at a glance https://www.npmjs.com/package/react-leaflet-draft.

MistreanuIonutCosmin commented 1 year ago

Thank you for your response! I will give it a try! Best regards!

kolarski commented 1 year ago

I'm not sure why that issue is closed, this is still an issue with the latest version

giovanesantossilva commented 1 year ago

Hello, I would like to suggest trying to use the plugin that I developed in order to solve these and other problems, to learn more at a glance https://www.npmjs.com/package/react-leaflet-draft.

lyvyu commented 1 year ago

Hello guys, still getting the same issue, is there any chance to be fixed or at least a workaround? 👀

giovanesantossilva commented 1 year ago

Hello, this problem was solved in my repository, if you want to take a look there https://github.com/giovanesantosilva/react-leaflet-draft or https://www.npmjs.com/package/react-leaflet-draft.

lyvyu commented 1 year ago

@giovanesantossilva thanks for the reply, tried ur repo but I get an error which other guys do to https://github.com/giovanesantossilva/react-leaflet-draft/issues/8

Can you look into that?

giovanesantossilva commented 1 year ago

Of course, I'll check, if I manage to solve it, I'll post it here then!

lyvyu commented 1 year ago

Of course, I'll check, if I manage to solve it, I'll post it here then!

Sure, you can even post on the original issue in ur repo, I’m following both.

Thanks mate!