-
Notifications
You must be signed in to change notification settings - Fork 481
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
ReferenceError: SkiaViewApi is not defined in React Native Web w/ react-native-skia 1.8.0 #2914
Comments
Hitting this as well when using react-native-web and expo! |
Getting the same error. Seems like 1.7.6 works, but 1.7.7 doesn't. |
Reproducible using the Hello Snack in the docs on v1.11.4. (Here's a Snack on v1.11.4 with the error) This issue does not seem to exist using Next.js with React Native Web nor Storybook. |
I've investigated this a bit and think it may be related to how metro handles globals, and that would explain why it doesn't happen in Next and Storybook (I have a vite-based project that doesn't have the issue). It seems to happen at bundle time, not runtime, so it's quite hard to work around it! For now because I don't need skia in the web version of my app (I'm only including a couple of screens), so I have added this to my metro config:
where
Obviously not a proper solution but adding it here in case it helps anyone. |
Seems like @wcandillon implemented a related fix in #2945 (Container.ts). However, this still seems to be broken in v1.11.5, so there's likely other global declarations still missing for |
Description
I am making an Expo application meant to work on iOS, Android, and the Web. I tried bumping react-native-skia to the latest version to leverage the new
sampling
property, but when running the application on the web, it throws:After further investigation, I've noticed that this pull-requests causes the error, especially: https://github.com/Shopify/react-native-skia/pull/2854/files#diff-628ba71b9ce2651cb45c9b0db8670f682532fe11fff3bb7b483b1f6b82dac43cR106. It looks like it tries to call a method on a global object (
SkiaViewApi
) but this object is not defined in the Expo Web environment.For now I'll roll back to
"@shopify/react-native-skia": "1.5.0"
as it is the recommended compatible version by Expo, but just wanted to let you know that releases >=1.8.0 seem to not be compatible with Expo Web/React Native for web.React Native Skia Version
1.8.0
React Native Version
0.76.6
Using New Architecture
Steps to Reproduce
Snack, Code Example, Screenshot, or Link to Repository
.
The text was updated successfully, but these errors were encountered: