You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If you have Canvas inside of RN Modal component and you suspend app to background and then return to your app, Skia Canvas completely disappear. Seems to be Android issue only.
I found out that I can hotfix this by manually triggering rerender of Canvas when AppState change, but it's not idea and there is still visible blink of Canvas.
Video:
screen-20240112-151242.mp4
Version
0.1.233
Steps to reproduce
Open Modal with Skia Canvas
Switch to different app
Switch back to your app => Canvas is gone
Snack, code example, screenshot, or link to a repository
@tamacroft I was not able to figure out fix for Skia itself but here is workaround that you can use. Use this hook in you components:
import{useEffect,useState}from'react';import{AppState}from'react-native';/** * It's necessary because Skia Android bug when Icon components are used in Modal component. * After app is suspended to background and then resumed, icons are not rendered. * This is a workaround for this issue. * @see https://github.com/Shopify/react-native-skia/issues/2135 */exportconstuseRerenderOnAppStateChange=()=>{const[_,setRerender]=useState(0);useEffect(()=>{consthandleChange=()=>{setRerender(prev=>prev+1);};constsubscription=AppState.addEventListener('change',handleChange);return()=>subscription.remove();},[]);};
Description
If you have
Canvas
inside of RNModal
component and you suspend app to background and then return to your app, Skia Canvas completely disappear. Seems to be Android issue only.I found out that I can hotfix this by manually triggering rerender of Canvas when AppState change, but it's not idea and there is still visible blink of Canvas.
Video:
screen-20240112-151242.mp4
Version
0.1.233
Steps to reproduce
Snack, code example, screenshot, or link to a repository
The text was updated successfully, but these errors were encountered: