LoginSignup
0
1

More than 5 years have passed since last update.

react-native-svgで親要素の色を継承する

Posted at
<Svg width='50' height='50' color='#666666'>
  <Circle
    cx='25'
    cy='25'
    r='22'
    fill='currentColor'
    stroke='black'
    strokeWidth='2'
  />
</Svg>

Circleのfill colorを親要素の色を与えたいという前提の場合。
こんな感じ。Svg要素にcolorを与え、子要素の中でfillなどの色を使うpropに対して currentColor という値を与える。これでCircleは #666666 でfillされる。

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1