React-native-svg: How to re-create (re-render) SVG element?

Created on 14 Sep 2016  路  4Comments  路  Source: react-native-svg/react-native-svg

Hello.
I have created element. Then I have got touch event and changed Rect width property. But Rect was not re-drawn at the render() function was called.
New elements were drawn, but old elements were not re-drawn with new properties.
But if these elements will have hided before they are re-draw - they will be shown successful.
What can I do?

Most helpful comment

I have found a method to resolve this problem. I have added increasing the KEY parameter:
<Svg width={width} height={height} key={this.k++}>

All 4 comments

I have found a method to resolve this problem. I have added increasing the KEY parameter:
<Svg width={width} height={height} key={this.k++}>

Thanks @proteye for your workaround, it worked for me too.
But I have a feeling it should not be necessary... @magicismight is there an explanation for the SVG component to not re-render when state or props is updated (on old elements)?

Having this same question.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

petrogad picture petrogad  路  3Comments

udfalkso picture udfalkso  路  3Comments

AdeilsonSuperlogica picture AdeilsonSuperlogica  路  3Comments

fjsun123 picture fjsun123  路  3Comments

a-c-sreedhar-reddy picture a-c-sreedhar-reddy  路  3Comments