Closed littlemaneuver closed 8 years ago
It seems to be an issue in Leaflet itself and not caused by this library, so you'll have to wait for a fix upstream or implement a workaround yourself.
The fix has been released already, but your peerDependency doesn't allow me to install version later than 0.7.x. and another reason is checking for the identity of two objects (leaflet icon), otherwise, setIcon is called every propagation cycle.
peerDependencies
does not constraint you in any way using npm 3, if you want to use another version you can set it in your own package.json
, but this library is not made to be compatible with Leaflet v1 yet, so it won't be supported until then.
So you can either implement a fix in your application code or wait for a release compatible with Leaflet v1, but I don't plan on implementing a fix in this lib itself as it's an issue from Leaflet.
Please make sure to check the following boxes before submitting an issue. Thanks!
Expected behavior
We are using leaflet icon as an icon so inside the componentDidUpdate method check like
this.props.icon !== prevProps.icon
is always true. It triggers setIcon method. This method is making marker draggable again here is the original issueActual behavior
The marker is draggable even I've changed my draggable prop to false
Steps to reproduce
then update props.drggable to false and you'll still get drggable marker.
This behavior could be fixed by setting more complex check on the icon property or by allowing to use leaflet version 1.0.0-rc.1
here is the proof this jsfiddle.