reanimated-skia-performance
Installation
SKILL.md
Reanimated + Skia Performance
Target stack: react-native-skia v3 (Graphite), react-native-reanimated 4.8+, react-native-worklets 0.14+.
Skia v2 note:
@shopify/react-native-skiastops at v2.14. v3 publishes asreact-native-skiaand requires Reanimated 4 (react-native-worklets >= 0.7.0), Android API 26+ with Vulkan 1.1, and iOS 15.1+. Stay onreact-native-skia@2(OpenGL ES) only when you must support Android < API 26, non-Vulkan devices, Android TV, or Expo Go.
Defaults
- Keep animation state off the JS thread:
useSharedValue,useDerivedValue, worklets. Never read aSharedValueon the JS thread (blocking round-trip to UI thread). - Prefer
shared.get()/shared.set()overshared.value(React Compiler safe). Use lazy inituseSharedValue(() => ...)for expensive objects andshared.modify(...)for in-place array/typed-array updates. - Minimize JS↔UI crossings: use
scheduleOnRN(fn, ...args)/scheduleOnUI(fn, ...args)fromreact-native-worklets(not deprecated curriedrunOnJS/runOnUI), and never per frame. - For Skia v3
<Canvas>, avoid per-frame React renders: passSharedValues orselect(sv, key)directly to Skia props/uniforms. The UI thread only writes updated values; a native thread pool replays Graphite frames. - Explicitly
.dispose()(or useusing) per-frame Skia NativeState objects (SkGraphiteRecording, offscreen images) inside UI/worklet loops; the UI runtime collects garbage rarely.