tanem / react-svg

:art: A React component that injects SVG into the DOM.

Home Page:https://npm.im/react-svg

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Path keep closed after injection

iamindrazulfi opened this issue · comments

Hey Tanem,

I am working on icon editor, i just wanted to create stroke adjuster with slider.
It was great in the app, but after download the path keep self closed.
Sac

image

Here is my code

 <ReactSVG
        src={src}
        onClick={onClick}
        beforeInjection={(svg) => {
          svg.setAttribute("width", "48px")
          svg.setAttribute("height", "48px")
          svg.querySelectorAll("*").forEach((el) => {
            el.setAttribute("stroke-width", strokewidth)
            el.setAttribute("stroke", color)
          })
        }}
      />

Is there any solution on this ?
Many Thanks!

Hiya, don't suppose you can create a working repro by forking the basic CodeSandbox example? Will make it easier to see what's going on.

Does it make any difference if you use afterInjection instead of beforeInjection?

Closing due to inactivity.