Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem rendering app relying on react-native-skia #12

Open
dmg46664 opened this issue Sep 28, 2023 · 2 comments
Open

Problem rendering app relying on react-native-skia #12

dmg46664 opened this issue Sep 28, 2023 · 2 comments

Comments

@dmg46664
Copy link

dmg46664 commented Sep 28, 2023

Please see the following repo folder 0009_portfolio_skia_render for replication steps:

https://github.com/dmg46664/problems/blob/main/0009_portfolio_skia_render/README.md

This is replicating this kind of code: https://snack.expo.dev/@wcandillon/hello-snack
, where the main app needs to be loaded in separate module to ensure a web assembly binary has loaded first.

The error is in the second scene which appears blank, with the following in the console:

image

But note that this doesn't happen on the standalone instructions which draws a pretty picture.

I imagine that the issue is the way Portfolio is triggering the js which means document.geElementById is in the wrong window. This is just speculation given I am sufficiently unfamiliar with Portfolio.

@cjohansen
Copy link
Owner

Hi, sorry for the late response. Yes, Portfolio runs your component in one window, and renders the result in an iframe. This causes problems with globals such as document. I don't have a quickfix for this, but I do have one approach to attempt. As a work-around, you can do (.querySelector (.closest rendered-element "body") "#my-id") to work in the right document, but this is only possible if you control the code in question, and won't always work unfortunately.

@cjohansen
Copy link
Owner

This will soon have a solution by way of this PR: #16

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants