-
Notifications
You must be signed in to change notification settings - Fork 548
Description
Hello guys,
first of all thank you for this amazing library. I playing with this library and I am trying to use it to render SVG icons instead of react-native-svg. Briefly discussed in #462 and solution you suggested works very well, but recently I noticed there is noticeable delay between component mount and when it actually renders anything. I tried to replace SVG with just some Circle component, to verify this is not related just some SVG loading and it seems it is not.
I tried both iOS and Android, development and production. It's little bit better in production and on iOS, but still noticeable especially on Android .
Do you think this is some Skia limitation or it's something that can be possibly improved? If it's something that could be improved I will try to figure it out.
Video (video is actually slowed down to 0.25x, but you can notice this as user even at normal speed):
simulator-screen-recording-iphone-13-2022-06-17-at-190240_7mNyXc5b.mov
And code of my Icon component:
const icons = {
close: require('close.svg');
...etc
}
export const Icon = ({ name, size = 'large', color = 'black' }: IconProps) => {
const svg = useSVG(icons[name]);
const {
utils: { colors },
} = useNativeStyles();
const sizeNumber = iconSizes[size];
const paint = usePaintRef();
return (
<Canvas style={{ height: sizeNumber, width: sizeNumber }}>
<Paint ref={paint}>
<BlendColor color={colors[color]} mode="srcIn" />
</Paint>
<Group layer={paint}>
{svg && <ImageSVG svg={svg} x={0} y={0} width={sizeNumber} height={sizeNumber} />}
</Group>
</Canvas>
);
};Thanks!