BjornMelin/dev-skills / archive/skills/native/native-skia
native-skia
VerifiedUse this skill for React Native Skia canvas animations, drawing primitives, Reanimated integration, CanvasKit/web caveats, performance, memory, and Expo/native validation. Trigger on React Native Skia, @shopify/react-native-skia, Skia Canvas, CanvasKit, Skia animation. Do not use for near-miss tasks outside these boundaries; route to adjacent motion or platform skills when they own the implementation.
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 4.7 KB |
| agents/openai.yaml | config | 332 B |
| archive.json | config | 677 B |
| assets/examples/native-skia-starter.tsx | other | 386 B |
| assets/templates/native-skia-audit-report.md | markdown | 629 B |
| assets/templates/native-skia-review-checklist.md | markdown | 1.3 KB |
| evals/evals.json | config | 4.0 KB |
| evals/trigger-queries.json | config | 4.0 KB |
| references/docs-react-native-skia-api-notes.md | markdown | 5.5 KB |
| references/docs-react-native-skia-installation.md | markdown | 11.3 KB |
| references/docs-software-mansion-canvas-animations.md | markdown | 15.3 KB |
| references/docs-software-mansion-canvas-atlas.md | markdown | 3.2 KB |
| references/image-font-shader-resource-cache.md | markdown | 2.3 KB |
| references/index.md | markdown | 696 B |
| references/provenance.json | config | 2.1 KB |
| references/skia-canvas-patterns.md | markdown | 1.4 KB |
| references/skia-performance-lifecycle.md | markdown | 1.4 KB |
| references/skia-reanimated-interoperability.md | markdown | 2.4 KB |
| references/skia-web-expo-boundaries.md | markdown | 1.4 KB |
| references/source-ledger.md | markdown | 1.6 KB |
| scripts/audit.mjsexecutable | script | 25.5 KB |
references/docs-react-native-skia-api-notes.md
View on GitHub# React Native Skia API Notes
Use this file when implementing or reviewing Skia code. It summarizes the
current upstream docs and package source without replacing them.
## Version And Install
- Expo SDK 56 bundles `@shopify/react-native-skia@2.6.2` for Android, iOS,
tvOS, web, and Expo Go. Prefer this version for Expo Go-compatible SDK 56
apps unless a custom dev build justifies a newer native module.
- Upstream latest checked on 2026-06-04 was
`@shopify/react-native-skia@2.6.4`. It depends on
`canvaskit-wasm@0.41.0` and Skia binary packages `147.1.0`, with peer
metadata for React 19, React Native, and Reanimated. See `source-ledger.md`
before changing pins.
- Current Skia docs require modern React Native and React for current releases;
the docs minimum is safer than package metadata when they differ. Older
RN/React stacks may need an older Skia package.
- The package runs a postinstall script to copy native binaries. Package
managers that block lifecycle scripts can produce missing-native-binary
failures.
- Video support and experimental Graphite have stricter Android API
requirements than basic Skia rendering.
## Canvas Size And Snapshots
- `Canvas` is the Skia drawing root and accepts normal RN view props, including
accessibility props.
- Use `style`, explicit width/height, or a measured parent so the canvas has a
nonzero layout size.
- Treat `Canvas` as a mounted native surface with its own renderer. Route
transitions, keys, backgrounding, and conditional rendering can destroy and
recreate GPU resources; keep domain state outside the canvas and rebuild
scene resources intentionally.
- `onSize` accepts a Reanimated shared value and updates when the canvas size
changes. Prefer it when drawing math belongs on the UI thread.
- `useCanvasSize()` returns a ref plus JS-thread size for cases that truly need
React state or JS measurements.
- `onLayout` canvas measurement is deprecated on Fabric; use `onSize` or
`useCanvasSize()`.
- Prefer `makeImageSnapshotAsync()` for snapshots that include textures because
it runs on the UI thread.
- `androidWarmup` is opt-in. Use it only for static or fully opaque drawings
after Android proof.
## Reanimated Integration
- Skia supports Reanimated shared and derived values as component props.
`createAnimatedComponent` and `useAnimatedProps` are usually unnecessary.
- Use `interpolateColors` from `@shopify/react-native-skia`; Reanimated
`interpolateColor` uses a different color representation.
- Skia animation hooks include path interpolation/value hooks, `useClock`,
`useRectBuffer`, and `useRSXformBuffer`.
- Keep high-frequency calculations in worklets/shared values. Avoid reading
`.value` on the JS thread in render paths, feeding React state every frame,
or allocating fresh arrays/objects inside derived values unless the API
requires it and the cost is measured.
- Derived values should close over stable inputs only. Move changing props,
dimensions, colors, and asset handles into shared values, memoized constants,
or explicit dependencies.
- Gesture handlers should update shared values on the UI thread and let Skia
consume them directly. Use RN overlays for per-element gestures and hit
targets when the canvas drawing itself has no semantic node.
## Images And Shaders
- `useImage()` returns `null` until loading finishes and accepts an optional
error handler. Render loading/error/fallback states deliberately.
- `useAnimatedImageValue()` returns a shared value for GIF/WebP frames and can
take a shared paused flag.
- Asset sources can be JS-bundled `require(...)`, native bundle names, network
URLs, encoded bytes, or generated pixel data. Check decode size, cache
pressure, retry/error handling, and placeholder layout before animating.
- Do not fetch, decode, or allocate image data inside worklets or frame-driven
callbacks. Load on the supported asset path, then pass stable image/texture
handles into the scene.
- `ImageShader` can draw an image as a shader with fit/rect/transform/sampling
controls.
- `Skia.RuntimeEffect.Make()` returns `null` on shader compile failure. Check it
before rendering a `Shader` or `RuntimeShader`.
- Runtime shader image filters need pixel-density testing because upstream docs
call out scaling behavior.
## Web And Tests
- Web uses CanvasKit WASM loaded asynchronously. Skia web components must not be
imported before CanvasKit is initialized.
- Use `WithSkiaWeb` for code-splitting or `LoadSkiaWeb()` to defer root
registration.
- Expo Router dev mode can evaluate files under `app/` before CanvasKit loads;
put lazily loaded Skia components outside `app/` when using that lane.
- Run `setup-skia-web` after package upgrades when relying on a local
`canvaskit.wasm`; CDN loading must match the installed CanvasKit version.
- Browsers limit active WebGL contexts. For many static canvases, Skia exposes
`__destroyWebGLContextAfterRender`, but it has a performance cost.
- Jest support uses Skia's custom environment and setup file:
`@shopify/react-native-skia/jestEnv.js` and
`@shopify/react-native-skia/jestSetup.js`.
- Validation should cover native rendering, resize, remount/unmount, memory,
reduced motion, image fallback/error states, shader compile failure, and web
CanvasKit only when web is in scope.
## Accessibility And Reduced Motion
- Treat canvas content as pixels, not semantic UI. Use RN overlays or adjacent
controls for labels, focus targets, hit areas, and screen-reader content.
- Pause, simplify, or replace decorative loops, animated images, particles, and
shader motion when reduced motion is enabled.
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis. | Stars: 471k | Updated | Claude CodeCodex | Verified | Install |
| diagnosing-superpowersobra/superpowersUse when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness. | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependencies | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| executing-plansobra/superpowersUse when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is available | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |