knapcio / react-leaflet-pixi-overlay

A react wrapper for the awesome Pixi Overlay: https://github.com/manubb/Leaflet.PixiOverlay
27 stars 16 forks source link

_reactLeaflet.useLeaflet is not a function - Is react-leaflet-pixi-overlay compatible with react-leaflet 3.x ? #10

Closed HarborneD closed 2 years ago

HarborneD commented 3 years ago

I'm getting _reactLeaflet.useLeaflet is not a function when using <PixiOverlay markers={markers} />

I notice that the example uses rather than so I am assuming the error I'm seeing is a react-leaflet 2.x vs 3.x issue but I've also seen some comments from people using this library with 3.x (apparently? )

Many thanks!

adefrutoscasado commented 3 years ago

I have the same problem: https://codesandbox.io/s/trusting-newton-8el09

Edit: Made it work here using react-leaflet 2.8.0

hugobarragon commented 3 years ago

No react-lefaletv3 is not suported yet but it will be

oyhan commented 3 years ago

No react-lefaletv3 is not suported yet but it will be

It's getting late

hugobarragon commented 3 years ago

Feel free to open a PR 😃 I had to much work lately

victorlin commented 3 years ago

This comes from the dependency use-leaflet. I've opened an issue there vadzim/use-leaflet#109 but last activity on the repo was ~1 year ago 😕

vadzim commented 2 years ago

Oh, guys... I didn't actually notice someone uses my module... Thanks, gonna fix it :)

hugobarragon commented 2 years ago

Hi, yes it cames from use-leaflet, but react-leaflet has a internal hook on v3 so it does not make sense to keep using another lib, for now, react-leaflet-pixi-overlay works great and it was designed on react-leaflet v2, i will try this week to open a PR for v3 support guys
https://react-leaflet.js.org/docs/api-map/#usemap

danh00 commented 2 years ago

any update on this? would be very handy to have, otherwise I might try to figure it out

hugobarragon commented 2 years ago

this PR removes use-leaflet lib to reduce deps and now will rework no react leaflet v3 https://github.com/knapcio/react-leaflet-pixi-overlay/pull/17

hugobarragon commented 2 years ago

React leaflet v3 updated!!
https://github.com/knapcio/react-leaflet-pixi-overlay/pull/18

danh00 commented 2 years ago

thanks for this hugo!

danh00 commented 2 years ago

could you give an example of how to use onClick in the marker to open the popup?

hugobarragon commented 2 years ago

could you give an example of how to use onClick in the marker to open the popup?

hi, please try the readme docs, if it does not work, open a new issue please

knapcio commented 2 years ago

As far as I know @hugobarragon's PRs resolved the issue. Closing :)