1

I have .svg file which I am converting svg component using SVGR. But SVGR has removed style tag in my .svg file. This was original .svg file with style tag

     viewBox="0 0 385.11 279.06" style="enable-background:new 0 0 385.11 279.06;" xml:space="preserve">
<style type="text/css">
    .st0{fill:#FFFFFF;}


    .st1{fill:#6FCCDD;}
</style>```

When I used SVGR , it removed style with this message
/* SVGR has dropped some elements not supported by react-native-svg: style */

how should i apply class level style in SVGR react native expo app and also svg component is not rendered in android app
spjgoku
  • 71
  • 1
  • 6

1 Answers1

0

React native does not have or support a <style> tag.

There are two possible solutions to your question :

  1. Create a Stylesheet like this
const styles = StyleSheet.create({
  .st0 : { fill : "#FFFFFF"},
  .st1 : {fill:#6FCCDD}
});

and apply it to your component using style={styles.st0}

  1. Apply the styles inline in the style tag itself

<Svg style={fill : "#FFFFFF"} />