Loading…
Getting Started with React Native Skia
2023-10-18
- Source
- Shopify
- Published
- Added to Yomu
Summary
React Native Skia exposes Google’s cross-platform Skia 2D graphics engine to React Native, giving developers a canvas for custom shapes, visual effects, and dynamic interactions. The article explains when to choose it over react-native-svg or standard React Native Views: SVG is optimized for static SVGs, while Skia supplies primitives such as shaders, path operations, and image filters for animated experiences. It introduces the Cartesian canvas, basic Circle, Rect, and RoundedRect shapes, and custom paths created with SVG notation or imperative commands including addCircle, lineTo, and addPoly. Examples then combine Skia with react-native-reanimated shared values for UI-thread animation and react-native-gesture-handler for panning, before adding Blur and DashPathEffect; the article also notes web support through React Native Web and points to further examples.
Context
The article is intended for React Native developers who are impressed by RN Skia but hesitate to try it because they do not know where to start. It also addresses choosing Skia for custom interactions beyond ordinary React Native components.
Approach / What changed
It teaches RN Skia through progressively richer examples: drawing basic and custom paths on a Cartesian canvas, animating shared values with react-native-reanimated, handling panning with react-native-gesture-handler, and applying built-in effects such as Blur and DashPathEffect. It also points to documentation, community examples, and web support through React Native Web.
Takeaways
- RN Skia uses a Cartesian canvas rather than flex or grid layout, allowing direct control over what is drawn at each pixel.
- Skia and react-native-reanimated interoperate directly, so shared values can control drawings without createAnimatedComponent or useAnimatedProps.
- Gesture callbacks and animations run on the UI thread outside React, supporting the article’s stated 60–120 frames-per-second interactions.