lkazberova / react-leaflet-geojson-patterns

The component extended default GeoJSON for support svg patterns
https://lkazberova.github.io/react-leaflet-geojson-patterns/documentation
10 stars 7 forks source link

Compilation error with react-leaflet version 3+ #2

Open quorth0n opened 3 years ago

quorth0n commented 3 years ago

Attempted import error: 'Path' is not exported from 'react-leaflet'.

Parisping commented 3 years ago

Attempted import error: 'Path' is not exported from 'react-leaflet'.

I'm running into the same problem with react-leaflet 3.2.0. Have any solutions been found?

quorth0n commented 3 years ago

No, I ended up writing my own implementation of this plugin. The code isn't terribly complex, plus if you handle updates with React's virtual DOM it will be more performant than this one. Essentially you just append SVGs for whichever pattern you're looking to create and then reference their IDs for the fill on the respective feature in leaflet.

CRolfe87 commented 2 years ago

Where or at what point did you append the SVGs, been scouring the docs to find how to do that?

quorth0n commented 2 years ago

Where or at what point did you append the SVGs, been scouring the docs to find how to do that?

Just in the react DOM as normal through a custom component. Where specifically in the DOM doesn't matter as long as they're in there, the fill patterns are linked "globally" by ID

bonesoul commented 2 years ago

@quorth0n any chances you can publish your work?

januszm commented 1 year ago

@lkazberova apologies for direct mention, but have you considered upgrading this project for the newest React Leaflet v4 or would you rather suggest to re-implement GeoJSONFillable in new projects

lkazberova commented 1 year ago

@januszm hey, no prob. Will try to do it in next days :)

tearat commented 8 months ago

any changes? Got the same error. Also need add support react 18+ and types I think

hooch commented 6 months ago

Sorry to revive this, but here's a truncated example of appending the SVG, as mentioned upthread.

<Polygon
    positions={[ .. ]}
    fillColor='url(#pattern)'
/>
<svg>
    <defs>
        <pattern id='pattern'>
          ..
        </pattern>
    </defs>
</svg>