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.

currentcolor fill support

See original GitHub issue

In the web browser, setting the fill of an SVG element (path, etc.) instructs the element to inherit its color from the parent of the SVG. Attempting this with a react-native-svg Svg.Path element currently results in the following warning: "currentcolor" is not a valid color or brush.

Could we add support for currentcolor fills? I have provided the example code and the stack trace below.

  <Svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16">
    <Svg.G fill="none" fill-rule="evenodd">
      <Svg.Path d="M-4-4h24v24H-4z" />
      <Svg.Path
        fill="currentcolor"
        fill-rule="nonzero"
        d="M16 7H3.83l5.59-5.59L8 0 0 8l8 8 1.41-1.41L3.83 9H16z"
      />
    </Svg.G>
  </Svg>
screen shot 2018-01-29 at 7 37 06 am

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:14

github_iconTop GitHub Comments

2reactions
VincentCATILLONcommented, Jan 4, 2019

For those searching for a way to use react-native-svg (version 6.x and below) with SVG containing currentColor or inherit value in fill attribute.

Let’s take a look at this PR which replaces currentColor (or inherit) values by reference to props.color and so emulate the currentColor behaviour.

https://github.com/CoorpAcademy/components/pull/1436/files#diff-90ea253cb3ce7782845a01a0787e17c0R82

Enjoy 🙌

0reactions
dohomicommented, Sep 7, 2022

I am running into this issue on newest expo and react-native. Is there a solution for

color={'currentcolor'}

without throwing a console warning?

Read more comments on GitHub >

github_iconTop Results From Across the Web

CSS currentColor value | Can I use... Support ... - CanIUse
A CSS value that will apply the existing color value to other properties like background-color , etc. Usage % of. all users, all...
Read more >
currentcolor | CSS-Tricks
Use cases. Using it in animation; Button borders and SVG fills that match the text · Interface design that inherits color all around...
Read more >
Understanding the currentColor Keyword in CSS - DigitalOcean
A super short post that tells you what the currentColor keyword is used for in CSS and how to make good use of...
Read more >
currentcolor fill support · Issue #589 · software-mansion/react ...
In the web browser, setting the fill of an SVG element (path, etc.) instructs the element to inherit its color from the parent...
Read more >
<color> - CSS: Cascading Style Sheets - MDN Web Docs
The currentcolor keyword represents the value of an element's color property. This lets you use the color value on properties that do not ......
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