Fix with-skia for Web and Windows install failure #660
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 ireact-native-reanimated@4.2.1 asks for react-native-worklets >= 0.7.0Limiting 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.wasmMoved logic into a separate node.js script. It could be a nice use for
/scriptsfolder 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 undefinedSimplified
async-skia.tsx. Had to cache the promise to prevent Expo from crashing after finishing bundling for Web.