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

[Windows] SVG disappearing when navigate

Open tgldr opened this issue 1 year ago • 5 comments

We are making a Windows app using react-native, react-navigation and react-native-windows.

But when we navigate to some page and go back to home screen, then our SVGs in home screen are all disappears. So I dive in to react-native-svg code base and found that Unload() method is the root cause of it.

https://github.com/software-mansion/react-native-svg/blob/main/windows/RNSVG/SvgView.cpp#L180

I am not expert of C++, If I remove this code It fixes, but I don't want to just remove it. So could you please take a look and provide the best solution for it? I am wondering is there any reverse solution like Reload or Load method.

Thanks.

tgldr avatar Aug 03 '23 19:08 tgldr

The Unload() method is needed to prevent memory leaks (more info here), so we would have to go the Load route.

marlenecota avatar Aug 07 '23 17:08 marlenecota

@marlenecota Thanks for answering. Yeah, I also believe there is a reason for using Unload(). I am not familiar with C++ and C#. Could you please provide how to implement the Load route if you have time. Thanks again.

tgldr avatar Aug 09 '23 18:08 tgldr

@tgldr What version of react native, react native windows, and react native svg are you using?

WilliamWelsh avatar Sep 29 '23 18:09 WilliamWelsh

@WilliamWelsh

I am using:

"react-native": "0.70.0", "react-native-windows": "0.70.19", "react-native-svg": "12.4.0"

tgldr avatar Oct 05 '23 16:10 tgldr

@tgldr - this might have been fixed by #2195. Can you let me know if you're still seeing this with that change?

marlenecota avatar Jan 11 '24 22:01 marlenecota

Hello @tgldr, Do you still have that issue?

bohdanprog avatar Jun 12 '24 12:06 bohdanprog