--- id: rn-reanimated-3-patterns title: Reanimated 3 — Worklet / shared value / 60fps category: Coding status: draft source_trust_level: B verification_status: conceptual created_at: 2026-05-09 updated_at: 2026-05-09 tags: [react-native, reanimated, animation, vibe-coding] tech_stack: { language: "TS / React Native", applicable_to: ["React Native"] } applied_in: [] aliases: [Reanimated 3, useSharedValue, useAnimatedStyle, worklet, runOnJS] --- # Reanimated 3 > RN 의 60fps animation 표준. **JS thread 안 거치는 worklet**. shared value + animated style. Gesture Handler 와 페어. v3 = 자동 worklet (babel plugin). ## 📖 핵심 개념 - Worklet: UI thread 에서 실행되는 JS 함수 (반응형). - Shared value: worklet ↔ JS 양쪽에서 read/write. - Derived value: shared value → 계산. - runOnJS / runOnUI: thread 간 호출. ## 💻 코드 패턴 ### Setup ```bash yarn add react-native-reanimated # babel.config.js: 'react-native-reanimated/plugin' 추가 (마지막) ``` ### Basic ```tsx import Animated, { useSharedValue, useAnimatedStyle, withSpring } from 'react-native-reanimated'; function Box() { const offset = useSharedValue(0); const style = useAnimatedStyle(() => ({ transform: [{ translateX: offset.value }], })); return ( <>