-
Notifications
You must be signed in to change notification settings - Fork 10
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
No Context Provided: useLeafletContext() can only be used in a descendant of MapContainer #17
Comments
If you're still working with react-leaflet V2, the last version of react-leaflet-google-v2 seems to be incompatible with react-leaflet v2. |
@FredChauviere As per my OP I am using 3.2.2. |
Oh sorry, I missed that information: I got the exact same error message with react-leaflet@2.8.0, I had to revert to react-leaflet-google-v2@5.1.3 |
I think I boiled it down. There is a compile error with react-leaflet and there is an aternative package as a work around until the PR gets merged. Well, implementing that work around caused there to then be two different packages of the core. Even though they are both the same package but one is aliased to work around other issues. So by using the MapContainer from the aliased alternative package that includes the context from the non-aliased *core package. Then with this package and other packages that try to use the context of the aliased *core package the context is then null because it is not the same exact context file. I don't see a workaround this without creating another forked package that I or someone publishes to npm that basically fixes the problem and is setup to work as an aliased package. Talk about dependency nightmare! References: |
hello @amaster507, sorry for the late reply, we were investigating the error you mentioned and we published a new version can you try the version 5.2.0, use react leaflet 3.2.2 and tell us if everything is okay now? |
Basically, v5.1.4 should have been v6 due to bump from react-leaflet v2 to v3 and associated breaking changes. |
Using react-leaflet@^3.2.2
I do have the code as a descendant of the MapContainer correctly, here is a minimal example of my setup:
The text was updated successfully, but these errors were encountered: