react-native-svg icon indicating copy to clipboard operation
react-native-svg copied to clipboard

Document toDataURL method

Open mghahari opened this issue 5 years ago • 4 comments

Feature Request

The toDataURL method wasn't documented.

Why it is needed

The toDataURL method is implemented in this library but wasn't documented. It is so useful that we can convert svg to png in react native. In my recent experience, I needed to use a svg image that maked dynamically as expo-three texture and it doesn't support svg. I was lucky that found this method in an issue. But another problem is that reference to main svg component is required to use this method but when using CssSvg, ... there is no straight forward way to get a ref to the main component and after I spend some time in reading code of this part I found that if we set the ref method in the override prop of CssSvg, ... it works but is cause some type mismatch error in the code editor.

mghahari avatar Jun 25 '20 17:06 mghahari

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. You may also mark this issue as a "discussion" and I will leave this open.

stale[bot] avatar Aug 28 '20 03:08 stale[bot]

Any updates on this? The toDataURL function is extremely useful..

cc @msand @magicismight

mrousavy avatar Oct 05 '20 13:10 mrousavy

Also, It will be useful that we can use this function headlessly. So we can convert SVG to png without creating a component.

mghahari avatar Oct 05 '20 15:10 mghahari

I approve this too, found a related issue here: https://github.com/react-native-svg/react-native-svg/issues/1588

LRNZ09 avatar Dec 01 '21 08:12 LRNZ09