fix: improve SkiaCameraCanvas layout handling#3668
fix: improve SkiaCameraCanvas layout handling#3668therealpurplemana wants to merge 1 commit intomrousavy:mainfrom
Conversation
Wraps the Skia Canvas with a View component to provide better layout control and flexibility. The View handles layout events and styles, while the Canvas receives explicit width/height dimensions. This fix is a backwards compatible patch for the post Skia 2.20 removal of canvas.onLayout. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
|
@therealpurplemana is attempting to deploy a commit to the mrousavy's Team Team on Vercel. A member of the Team first needs to authorize it. |
|
Super important PR. Right now, it is not possible so the "useSkiaFrameProcessor" with Skia ˆ2.0.0 in the new arch. |
|
Yes please 🥹 just got started with vision-camera etc and hit this right away when trying my first frame processor 😅 Maybe it might even be interesting to be able to pass a custom |
|
Could you please approve it? This is very needed. Thanks @therealpurplemana! |
|
I would encourage more testing with it please before we merge. Can folks please pull the branch and test it locally and share results? |
|
I pulled in your branch and tried it. Seems to work at first sight, the explicit error is also gone! After 14-ish frames, the video feed freezes. I'm doing nothing at all in the frame processor, just rendering the frame itself. The app's running out of memory, it seems like a memory leak. I suppose that's the issue being talked about here. const frameProcessor = useSkiaFrameProcessor((frame) => {
'worklet';
frame.render();
}, []) |
Yes still memory issue. You can get it working at 15 fps with low format (2048), but it will look horrible |
|
onLayout is not support new arc!!! |
What
Wraps the Skia Canvas with a View component to provide better layout control and flexibility. The View handles layout events and styles, while the Canvas receives explicit width/height dimensions.
This fix is a backwards compatible patch for the post Skia 2.20 removal of
canvas.onLayout.Changes
Viewimport fromreact-nativeto wrap the Skia Canvas componentonLayoutand style props to the outerViewwrapperwidthandheightstyles to theSkiaProxy.Canvasbased on layout measurements{ flex: 1 }to maintain backwards compatibilityTested on
Related issues
onLayoutin v2.2.1 #3598🤖 Generated with Claude Code