Files
mattermost-mobile/patches/react-native-svg+12.1.1.patch
Elias Nahum 0c0f92a237 [Gekidou] Markdown SVG & image size support (#6032)
* Support Markdown svg and custom size inline images

* remove commonmark patches

* move getMarkdownImageSize to @utils/markdown

* Fix worklet not present while running unit tests that use calculateDimensions

* Set max size for SVG

* Set svg dimensions based on calculated size

* feedback review
2022-03-10 09:03:09 -03:00

24 lines
711 B
Diff

diff --git a/node_modules/react-native-svg/src/xml.tsx b/node_modules/react-native-svg/src/xml.tsx
index 828f104..462be2e 100644
--- a/node_modules/react-native-svg/src/xml.tsx
+++ b/node_modules/react-native-svg/src/xml.tsx
@@ -133,10 +133,17 @@ export function SvgUri(props: UriProps) {
useEffect(() => {
uri
? fetchText(uri)
- .then(setXml)
+ .then((xml) => {
+ if (xml && /xmlns="http:\/\/www.w3.org\/[0-9]*\/svg"/.test(xml)) {
+ setXml(xml);
+ return;
+ }
+ onError();
+ })
.catch(onError)
: setXml(null);
}, [onError, uri]);
+
return <SvgXml xml={xml} override={props} />;
}