It took a lot of tries to get this combination working on web. So documenting hoping this is useful for others. 🙂 This will not work on mobile platforms as is.
Steps:
- Create expo app
npx create-expo-app expo-router-with-skia
- Install dependencies for web
npx expo install react-dom react-native-web @expo/webpack-config
- Install expo router
npx expo install expo-router react-native-safe-area-context react-native-screens expo-linking expo-constants expo-status-bar react-native-gesture-handler
- Follow rest of the Getting Started steps.
- Create directory app and move the
App.js
into it and rename it toindex.jsx
- Start the server and verify everything works so far
npx expo --clear
- Now stop the server and add react-native-skia
npx expo install @shopify/react-native-skia npx setup-skia-web
- Create
postinstall.js
in root (find it in this project) - Add this to scripts in
package.json
"scripts": { "postinstall": "node postinstall.js; npx setup-skia-web" }
- Install
react-native-reanimated
and add it tobabel.config.js
npx expo install react-native-reanimated
- Install
@babel/plugin-proposal-export-namespace-from
and add it tobabel.config.js
npx expo install @babel/plugin-proposal-export-namespace-from -- -D
- Use
HelloWorld.jsx
in this project for testing - Load Skia before loading
HelloWorld.jsx
inyour index.jsx
- https://docs.expo.dev/tutorial/create-your-first-app/
- https://expo.github.io/router/docs/#getting-started
- https://shopify.github.io/react-native-skia/docs/getting-started/installation/
- https://shopify.github.io/react-native-skia/docs/getting-started/web
- https://shopify.github.io/react-native-skia/docs/getting-started/web#manual-webpack-installation
- https://shopify.github.io/react-native-skia/docs/getting-started/hello-world
- Shopify/react-native-skia#1448 (comment)