mattermost-mobile/patches/react-native-svg+12.1.1.patch
Mattermost Build c4b683a58f
Fix when SVG uri does not return data in the url (#5973) (#5974)
(cherry picked from commit cef3295420)

Co-authored-by: Elias Nahum <nahumhbl@gmail.com>
2022-02-15 21:40:13 -03:00

19 lines
596 B
Diff

diff --git a/node_modules/react-native-svg/src/xml.tsx b/node_modules/react-native-svg/src/xml.tsx
index 828f104..b480cee 100644
--- a/node_modules/react-native-svg/src/xml.tsx
+++ b/node_modules/react-native-svg/src/xml.tsx
@@ -133,7 +133,13 @@ export function SvgUri(props: UriProps) {
useEffect(() => {
uri
? fetchText(uri)
- .then(setXml)
+ .then((xml) => {
+ if (xml) {
+ setXml(xml);
+ return;
+ }
+ onError();
+ })
.catch(onError)
: setXml(null);
}, [onError, uri]);