4

I have encountered this error after installing react-native-svg. I have all svg icons in a separate .js file and calling them as follows,

<Icons name={'dot'} style={{height:4, width:4, marginRight:10}} color={"#D8D8D8"}/>

as per this Solution, What ever the values I have given in style object are integers only. But still I am facing this error.

As per this git Solution, some one is asking to downgrade and some one is asking to upgrade react native. But not sure which one gives permanent fix to this error.

Can somebody please let me know root cause of the error and permanent fix for this. Thank You.

ThinkAndCode
  • 1,319
  • 3
  • 29
  • 60

1 Answers1

1

as i know this issue happens when you set width and height style to Icon component

you should set size prop to <Icon />

your code should be Like this :

<Icons name={'dot'} size={15} style={{marginRight:10}} color={"#D8D8D8"}/>
  • 1
    As per `react-native-svg`, there is no such a prop `size`. And moreover this issue not only happens with `height` or `Width`, but also with `margin` (`marginTop` or `marginBottom` etc...) – ThinkAndCode Dec 31 '18 at 09:37
  • try add a view as parent and set styles to parent view – MoHammaD ReZa DehGhani Dec 31 '18 at 09:57
  • As you said, we can set height, width or margins to view. But I have recently faced an error `Error while updating property 'fill' of a view managed by: RNSVGPath `. So wrapping in a view may not be a right solution for these issues. Can you suggests something else to prevent these issues? – ThinkAndCode Jan 04 '19 at 10:44