Open chuducandev opened 3 weeks ago
Thank you for reporting this Anderson, I don't understand the issue. Could help me to try to get a sense of what is happening? Is is related to ImageSVG
only or any Skia Canvas will disappear? if you have a RN view with the canvas, will the view be visible as well?
I hope you can help me get a sense of what might be happening.
I believe this bug is related to the ImageSVG
component. When I set the backgroundColor: red
style on the Canvas
component, I noticed that it persisted even after switching back to the tab. Additionally, removing the wrapped Group
component did not resolve the issue.
const Screen = () => {
const svg = useSVG(require('@simpled-ai-kits/assets/svg/logo.svg'));
return (
<View>
<SafeAreaView>
<Canvas style={{ width: 32, height: 32, backgroundColor: 'red' }}>
<Group transform={[
{ translateX: 0 },
{ translateY: 0 },
{ scaleX: 0.16 },
{ scaleY: 0.16 },
]}>
<ImageSVG svg={svg} x={0} y={0} width={32} height={32} />
</Group>
</Canvas>
</SafeAreaView>
<Canvas style={{ width: 32, height: 32, backgroundColor: 'red' }}>
<Group transform={[
{ translateX: 0 },
{ translateY: 0 },
{ scaleX: 0.16 },
{ scaleY: 0.16 },
]}>
<ImageSVG svg={svg} x={0} y={0} width={32} height={32} />
</Group>
</Canvas>
</View>
);
};
@chuducandev I tried the example but couldn't reproduce the issue. Maybe if you do a small repository where we can reproduce the issue?
@wcandillon Thanks for looking into this! I’ve created a small repository to help reproduce the issue. You can find it here: GitHub Repo - MissingSVGAfterSwitching. Please let me know if you need any further details or have additional questions.
Description
Description
I encountered an issue with the
react-native-skia
library where an SVG image rendered outside a SafeAreaView disappears after switching tabs in acreateBottomTabNavigator
. The SVG insideSafeAreaView
renders consistently across tab switches, but the one outside disappears when returning to the first tab.Additional Context
The issue might relate to how
react-native-skia
handles component re-renders outside ofSafeAreaView
on tab switch. SettingdetachInactiveScreens={false}
on the navigator did not resolve this.Workaround Attempts
Wrapping both
Canvas
components inside aSafeAreaView
resolved the issue, but ideally, both should render correctly regardless of their placement.Thank you for looking into this! Please let me know if you need further information or if there are potential workarounds for this issue.
Version
1.5.0
Steps to reproduce
Steps
SafeAreaView
is visible.Expected Behavior
Both SVGs should render consistently when switching between tabs, regardless of their placement in
SafeAreaView
.Actual Behavior
The SVG outside the
SafeAreaView
disappears when switching back to the first tab.Snack, code example, screenshot, or link to a repository
Environment
Code to Reproduce
Recording Video
https://github.com/user-attachments/assets/864af123-2dfb-41a3-872d-7ab284207d78