The Konva.Image.fromURL() method is the only way to render a native SVG mentioned in the documentation. I haven't found any other way to display an SVG from a variable without using 3rd party libraries.
Konva.Path cannot be used as an SVG consists of multiple elements and the library fails to render it correctly.
Using 3rd party libraries is not a good option either, as they reduce the picture quality and are not native methods.
Can anyone help me with finding a native way to render an SVG without compromising its quality, please?
example from docs:
Konva.Image.fromURL('./test.svg', (imageNode) => {
layerRef.current.add(imageNode);
imageNode.setAttrs({
width: 150,
height: 150,
x: 10,
y: 10,
});
layerRef.current.batchDraw();
its works
my example:
`const svg = <svg ... </svg>
Konva.Image.create(svg, (imageNode) => {
layerRef.current.add(imageNode);
imageNode.setAttrs({
width: 150,
height: 150,
x: 10,
y: 10,
});
layerRef.current.batchDraw();`