react-native-svg
Advanced tools
Comparing version 14.0.0 to 14.1.0
@@ -56,2 +56,3 @@ cmake_minimum_required(VERSION 3.13) | ||
react_render_imagemanager | ||
react_utils | ||
) | ||
@@ -58,0 +59,0 @@ |
@@ -646,5 +646,7 @@ "use strict"; | ||
onError = _reactNativeSvg.err, | ||
onLoad | ||
onLoad, | ||
fallback | ||
} = props; | ||
const [xml, setXml] = (0, React.useState)(null); | ||
const [isError, setIsError] = (0, React.useState)(false); | ||
(0, React.useEffect)(() => { | ||
@@ -654,4 +656,10 @@ uri ? (0, _reactNativeSvg.fetchText)(uri).then(data => { | ||
onLoad === null || onLoad === void 0 ? void 0 : onLoad(); | ||
}).catch(onError) : setXml(null); | ||
}).catch(e => { | ||
onError(e); | ||
setIsError(true); | ||
}) : setXml(null); | ||
}, [onError, uri, onLoad]); | ||
if (isError) { | ||
return fallback ?? null; | ||
} | ||
return /*#__PURE__*/React.createElement(SvgCss, { | ||
@@ -658,0 +666,0 @@ xml: xml, |
@@ -636,5 +636,7 @@ import * as React from 'react'; | ||
onError = err, | ||
onLoad | ||
onLoad, | ||
fallback | ||
} = props; | ||
const [xml, setXml] = useState(null); | ||
const [isError, setIsError] = useState(false); | ||
useEffect(() => { | ||
@@ -644,4 +646,10 @@ uri ? fetchText(uri).then(data => { | ||
onLoad === null || onLoad === void 0 ? void 0 : onLoad(); | ||
}).catch(onError) : setXml(null); | ||
}).catch(e => { | ||
onError(e); | ||
setIsError(true); | ||
}) : setXml(null); | ||
}, [onError, uri, onLoad]); | ||
if (isError) { | ||
return fallback ?? null; | ||
} | ||
return /*#__PURE__*/React.createElement(SvgCss, { | ||
@@ -648,0 +656,0 @@ xml: xml, |
@@ -23,3 +23,3 @@ import * as React from 'react'; | ||
export declare function SvgCss(props: XmlProps): React.JSX.Element; | ||
export declare function SvgCssUri(props: UriProps): React.JSX.Element; | ||
export declare function SvgCssUri(props: UriProps): React.JSX.Element | null; | ||
export declare class SvgWithCss extends Component<XmlProps, XmlState> { | ||
@@ -26,0 +26,0 @@ state: { |
{ | ||
"version": "14.0.0", | ||
"version": "14.1.0", | ||
"name": "react-native-svg", | ||
@@ -25,3 +25,3 @@ "description": "SVG library for react-native", | ||
"windows", | ||
"react-native-config.js" | ||
"react-native.config.js" | ||
], | ||
@@ -28,0 +28,0 @@ "react-native-builder-bob": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
2886612
935
23788