Skip to content

Conversation

@AlexSin0
Copy link

PR fixes multiple issues in the with-skia example that prevent it from working correctly on Web and developed on Windows.

Changes were tested on Windows using both npm and pnpm for Web and Android.

It's my first time working with templates so any corrections are welcome. Thank you!

Fixes

1. When creating a project with this example npm exits with code 1.
Running npm i react-native-reanimated@4.2.1 asks for react-native-worklets >= 0.7.0

Limiting react-native-reanimated to ~4.1.1 should be enough according to compatibility table.

2. Postinstall script is for Linux and fails on Windows.
mkdir public; cp $(node -p \"require.resolve('canvaskit-wasm/bin/full/canvaskit.wasm', { paths: [require.resolve('@shopify/react-native-skia')] })\") public/canvaskit.wasm

Moved logic into a separate node.js script. It could be a nice use for /scripts folder but having is as standalone file works too. Inlining logic directly into postinstall would be difficult to maintain.

3. Example app stops working after first browser page reload.
can't access property "RuntimeEffect", this.CanvasKit is undefined

Simplified async-skia.tsx. Had to cache the promise to prevent Expo from crashing after finishing bundling for Web.

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

Successfully merging this pull request may close these issues.

1 participant