I am rendering SVGs from remote URLs:
import { SvgUri } from "react-native-svg";
function RemoteSVG() {
return (
<SvgUri
uri={"https://cdn.orsive.com/avatars/3tYL96SMyBcwUakNphevH-avatar.svg"}
style={{
width: 100,
height: 100,
backgroundColor: "blue",
}}
/>
);
}
I want to show loading indicator/skeleton when the SVG is being fetched and loaded, but SvgUri
component from react-native-svg
doesn't have onLoad
and onLoadEnd
props. So, I tried setting backgroundColor
, but once the SVG gets loaded, the background of the SVG also gets affected. It kinda looks like this:
Is there a way to show a loading skeleton when the SVG is being loaded?