Closed IanMayo closed 1 year ago
Hi, thanks for your PR but I can't find any mention of the setInteractive
method in Leaflet's docs, could you please point me to the relevant page?
Hello @PaulLeCam
I'm afraid I don't have easy access to the leaflet sources - but was following the code pattern in the rest of this method. It was an attempt to update this property:
Yes that can be set as an option, but I'm wondering about the method call you're using here? I don't want to use any undocumented or internal Leaflet API in React Leaflet to avoid possible breaking changes.
Aah, I see my mistake.
Is there alternate way we would update the state of interactive
?
Yes, if you set a unique key
on the element you want to change props for, React will re-create it so the options should be picked-up by React Leaflet when creating the new element.
Thanks for your support @PaulLeCam
Behold my current workaround:
It looks like my workaround is actually the valid solution, though it looks more like a react-trick than formal support for the property. But, if you do feel this is the valid solution, please feel free to close the PR.
Thanks again :-) Ian
The underlying leaflet marker object should be updated if
interactive
changes in the props.