react-leaflet-draw icon indicating copy to clipboard operation
react-leaflet-draw copied to clipboard

popup with event handling

Open arendeutsch opened this issue 5 years ago • 1 comments

Hello,

when im adding markers to the map im trying to create a popup for each marker with event handling, but keep running into issues. when i try to generate a popup with a div and bind it I get type error message (appendchild on node) if i convert the whole popup into string then the onclick or onchange event doesnt work.

Is there any way to work around it ?

arendeutsch avatar Jan 18 '20 12:01 arendeutsch

maybe this can help, it would add the text from the state to the especific object

_onCreated = (e) => {
    let type = e.layerType;
    let layer = e.layer;
    console.log(layer)
    
    if (type === 'marker') {
        layer.bindTooltip(this.state.typeforCreateMarker);
    }
    if (type === 'polyline') {
        layer.bindTooltip(this.state.typeforCreatePolyline);
    }
}

rodri595 avatar Sep 11 '20 21:09 rodri595