mirror of
https://github.com/zoriya/react-native-svg.git
synced 2026-06-04 15:44:24 +00:00
fix: Call onLoad prop in SvgCssUri (#1927)
SvgCssUri calls onLoad if it's passed, just like in PR #1817 (with SvgUri).
This commit is contained in:
+10
-3
@@ -695,11 +695,18 @@ export function SvgCss(props: XmlProps) {
|
||||
}
|
||||
|
||||
export function SvgCssUri(props: UriProps) {
|
||||
const { uri, onError = err } = props;
|
||||
const { uri, onError = err, onLoad } = props;
|
||||
const [xml, setXml] = useState<string | null>(null);
|
||||
useEffect(() => {
|
||||
uri ? fetchText(uri).then(setXml).catch(onError) : setXml(null);
|
||||
}, [onError, uri]);
|
||||
uri
|
||||
? fetchText(uri)
|
||||
.then((data) => {
|
||||
setXml(data);
|
||||
onLoad?.();
|
||||
})
|
||||
.catch(onError)
|
||||
: setXml(null);
|
||||
}, [onError, uri, onLoad]);
|
||||
return <SvgCss xml={xml} override={props} />;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user