mirror of
https://github.com/zoriya/react-native-svg.git
synced 2026-08-16 02:44:58 +00:00
Minor fix to prevent crash when Loaded fires twice (#2180)
There are many reasons Loaded can fire twice. Usually, it will happen when the native SvgView component is moved, but it can also happen if an ancestor of SvgView is reparented. There is a crash that appears to occur when we attempt to call CreateResources twice. This resolves that crash.
This commit is contained in:
@@ -202,8 +202,10 @@ void SvgView::CreateResources() {
|
||||
|
||||
void SvgView::Panel_Loaded(IInspectable const &sender, xaml::RoutedEventArgs const & /*args*/) {
|
||||
if (auto const &svgView{sender.try_as<RNSVG::SvgView>()}) {
|
||||
m_loaded = true;
|
||||
svgView.CreateResources();
|
||||
if (!m_loaded) {
|
||||
m_loaded = true;
|
||||
svgView.CreateResources();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user