question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Question

I’m using this smooth-code svg to jsx converter to render my svg components. My designer co-worker is sending me the svg files with the style element, it looks like this:

<style>.a{fill:none;}.b{clip-path:url(#a);}.c{clip-path:url(#b);}.d{fill:#fff;}.e{fill:#f8cd2d;}.f{fill:#e2222c;}.g{fill:#14673b;}.h{clip-path:url(#c);}</style>

smooth-code converts them but with this message:

/* SVGR has dropped some elements not supported by react-native-svg: style */

And because of that, the svg is fully black when rendered… I dont know what to say to my co-worker to fix this at his end (He uses Adobe XD), so the workaround I found is to manually add the fill prop with the needed color…

Is there a better solution?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:10

github_iconTop GitHub Comments

1reaction
msandcommented, Feb 29, 2020

There is support for the style element in SvgCss nowadays

0reactions
goff-studiocommented, Jan 14, 2022

@myitelekt those are dynamic xmls that I receive from the backend. the solution was using SvgCss,

Read more comments on GitHub >

github_iconTop Results From Across the Web

The Style Information element - HTML - MDN Web Docs
The <style> HTML element contains style information for a document, or part of a document. It contains CSS, which is applied to the...
Read more >
HTML style tag - W3Schools
The <style> tag is used to define style information (CSS) for a document. Inside the <style> element you specify how HTML elements should...
Read more >
4.2.6 The style element — HTML5: Edition for Web Authors
The style element allows authors to embed style information in their documents. The style element is one of several inputs to the styling...
Read more >
The HTML <style> Element - Educative.io
The HTML <style> element is used to style an HTML document or part of a document without the need for an external stylesheet....
Read more >
HTML style attribute - GeeksforGeeks
Inline Style: In Inline styling, the CSS rules are directly written inside the starting tag using the style attribute. The style attribute ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found