pressing the button to get the base64 string of the svg ... produces the following error:
- Only the original thread that created a view hierarchy can touch its views
render() {
return (
<ScrollView contentContainerStyle={styles.container}>
<Svg
ref={c => (this.svg = c)}
height="50%"
width="50%"
viewBox="0 0 100 100"
>
<Circle
cx="50"
cy="50"
r="45"
stroke="blue"
strokeWidth="2.5"
fill="green"
/>
</Svg>
<TouchableOpacity
onPress={() => {
this.svg.toDataURL(data => {
console.log("data", data);
});
}}
>
<Text>Get Data</Text>
</TouchableOpacity>
</ScrollView>
);
}
Any help?
I finally figured this out ...
It was npm (v 6.4.1) issue, cause when I removed node-modules folder and package-lock.json and tried to install it back using yarn, it worked like before.
I installed a newer version of react-native-svg, which does not work for me, when I tried to downgrade to an older version using npm, for some reason it does not recognize it, and package-lock.json kept creating with the newer version i uninstalled!