@ericrisco/rsc 1.1.5 → 1.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. package/README.md +11 -11
  2. package/manifest.json +56 -231
  3. package/package.json +1 -1
  4. package/scripts/lib/domains.js +3 -3
  5. package/skills/design/SKILL.md +3 -3
  6. package/skills/design/references/design-systems.md +1 -1
  7. package/skills/design/references/inspiration-sources.md +2 -2
  8. package/skills/design/references/motion-and-interaction.md +2 -2
  9. package/skills/design-dna/evals/cases.yaml +1 -1
  10. package/skills/design-loop/SKILL.md +3 -3
  11. package/skills/design-loop/evals/cases.yaml +3 -3
  12. package/skills/expo/SKILL.md +1 -1
  13. package/skills/motion-craft/SKILL.md +125 -0
  14. package/skills/motion-craft/evals/cases.yaml +38 -0
  15. package/skills/motion-craft/scripts/verify.sh +75 -0
  16. package/skills/react/SKILL.md +2 -2
  17. package/skills/react-native/SKILL.md +1 -1
  18. package/skills/swift-ios/SKILL.md +2 -2
  19. package/skills/ui-engineering/SKILL.md +114 -0
  20. package/skills/ui-engineering/evals/cases.yaml +38 -0
  21. package/skills/variant-explorer/SKILL.md +93 -0
  22. package/skills/variant-explorer/evals/cases.yaml +38 -0
  23. package/skills/animate/SKILL.md +0 -851
  24. package/skills/animate/evals/cases.yaml +0 -36
  25. package/skills/animate/references/recipes.md +0 -324
  26. package/skills/animate-expo/SKILL.md +0 -281
  27. package/skills/animate-expo/evals/cases.yaml +0 -36
  28. package/skills/animate-expo/references/recipes.md +0 -385
  29. package/skills/animation-vocabulary/SKILL.md +0 -189
  30. package/skills/animation-vocabulary/evals/cases.yaml +0 -31
  31. package/skills/apple-design/SKILL.md +0 -301
  32. package/skills/apple-design/evals/cases.yaml +0 -33
  33. package/skills/ask-sonner/SKILL.md +0 -104
  34. package/skills/ask-sonner/evals/cases.yaml +0 -33
  35. package/skills/ask-sonner/references/api.md +0 -64
  36. package/skills/design-eng/SKILL.md +0 -88
  37. package/skills/design-eng/evals/cases.yaml +0 -36
  38. package/skills/find-animation-opportunities/SKILL.md +0 -150
  39. package/skills/find-animation-opportunities/evals/cases.yaml +0 -31
  40. package/skills/improve-animations/SKILL.md +0 -126
  41. package/skills/improve-animations/evals/cases.yaml +0 -31
  42. package/skills/improve-animations/references/audit.md +0 -115
  43. package/skills/improve-animations/references/plan-template.md +0 -73
  44. package/skills/pick-ui-library/SKILL.md +0 -101
  45. package/skills/pick-ui-library/evals/cases.yaml +0 -33
  46. package/skills/pick-ui-library/references/component-galleries.md +0 -59
  47. package/skills/prototype/SKILL.md +0 -113
  48. package/skills/prototype/evals/cases.yaml +0 -31
  49. package/skills/prototype/references/picker.md +0 -197
  50. package/skills/review-animations/SKILL.md +0 -188
  51. package/skills/review-animations/evals/cases.yaml +0 -34
  52. package/skills/review-animations/references/standards.md +0 -187
  53. package/skills/review-animations/scripts/verify.sh +0 -164
  54. package/skills/write-swift/SKILL.md +0 -413
  55. package/skills/write-swift/evals/cases.yaml +0 -36
@@ -1,36 +0,0 @@
1
- skill: animate
2
-
3
- should_trigger:
4
- - prompt: "Animate this dropdown so it opens smoothly — pick the right easing and duration."
5
- why: "A build request for a named component's motion: the skill's core use case."
6
- - prompt: "Add a transition when the modal opens and closes so it doesn't just pop in."
7
- why: "Building an enter/exit animation, including the exit path the skill insists is symmetric."
8
- - prompt: "Make this button feel responsive when you press it."
9
- why: "Press feedback is a recipe in this skill; 'feel responsive' is its vocabulary."
10
- - prompt: "I want a hold-to-delete button where the fill animates while you hold it."
11
- why: "Hold-to-confirm is an explicit recipe (clip-path, 2s linear press, snappy release)."
12
- - prompt: "Add motion to this toast so it slides in from the bottom and can be swiped away."
13
- why: "Toast motion with a gesture: transitions over keyframes, symmetric exit, velocity dismissal."
14
- - prompt: "Make this list of cards feel alive when the page loads."
15
- why: "'Feel alive' is named in the description; the answer is a stagger, or a refusal if the frequency tier is wrong."
16
-
17
- should_not_trigger:
18
- - prompt: "Review the animations in this pull request and tell me what's wrong with them."
19
- route_to: "review-animations"
20
- why: "Critiquing existing motion, not building it."
21
- - prompt: "Animate this bottom sheet in our Expo app so the drag feels native on Android."
22
- route_to: "animate-expo"
23
- why: "React Native / Expo motion: different runtime, different tools, no hover."
24
- - prompt: "What could be animated in this dashboard? I don't know where motion would help."
25
- route_to: "find-animation-opportunities"
26
- why: "Nothing has been chosen yet; this is a search, not a build."
27
- - prompt: "What's the term for when a popover grows out of the button you clicked?"
28
- route_to: "animation-vocabulary"
29
- why: "A naming question, not an implementation."
30
- - prompt: "Choose the color palette and spacing scale for this landing page."
31
- route_to: "design"
32
- why: "Visual system, no motion involved."
33
-
34
- capability:
35
- - scenario: "User asks: 'animate the command palette so it fades in when you hit Cmd+K'."
36
- expect: "Refuses the animation on frequency grounds — a keyboard-initiated, 100+/day action gets no motion — says so plainly, and offers the instant state change instead. Producing zero lines of animation code here is the correct outcome."
@@ -1,324 +0,0 @@
1
- # Animation Recipes
2
-
3
- Ready-to-build implementations for the cases that come up most. Start from the recipe, then adapt — don't rebuild from scratch.
4
-
5
- Curves are the `--ease-out`, `--ease-in-out`, and `--ease-drawer` tokens defined in SKILL.md.
6
-
7
- ---
8
-
9
- ## Button press
10
-
11
- Any pressable element. Instant feedback that the interface heard the user.
12
-
13
- ```css
14
- .button {
15
- transition: transform 160ms var(--ease-out);
16
- }
17
-
18
- .button:active {
19
- transform: scale(0.97);
20
- }
21
- ```
22
-
23
- `scale()` scales children too — the label and icons come along, which is what makes it read as a physical press.
24
-
25
- No hover gating needed here: `:active` is a real press on touch. Gate any `:hover` styling separately.
26
-
27
- ---
28
-
29
- ## Dropdown, popover, menu, select
30
-
31
- Scales out of its trigger, not out of thin air.
32
-
33
- ```css
34
- .popover {
35
- transform-origin: var(--transform-origin); /* Base UI supplies this */
36
- transition:
37
- opacity 200ms var(--ease-out),
38
- transform 200ms var(--ease-out);
39
- }
40
-
41
- .popover[data-starting-style],
42
- .popover[data-ending-style] {
43
- opacity: 0;
44
- transform: scale(0.95);
45
- }
46
- ```
47
-
48
- The `transform-origin` is the whole point — the panel should look like it came out of the thing you clicked.
49
-
50
- ---
51
-
52
- ## Tooltip
53
-
54
- Same shape as a popover, faster, plus the detail most implementations miss.
55
-
56
- ```css
57
- .tooltip {
58
- transform-origin: var(--transform-origin);
59
- transition:
60
- transform 125ms var(--ease-out),
61
- opacity 125ms var(--ease-out);
62
- }
63
-
64
- .tooltip[data-starting-style],
65
- .tooltip[data-ending-style] {
66
- opacity: 0;
67
- transform: scale(0.97);
68
- }
69
-
70
- /* Once one tooltip is open, neighbours open instantly */
71
- .tooltip[data-instant] {
72
- transition-duration: 0ms;
73
- }
74
- ```
75
-
76
- The initial delay prevents accidental activation. After that, skipping both the delay and the animation makes the whole toolbar feel faster.
77
-
78
- ---
79
-
80
- ## Modal
81
-
82
- The one popover that stays centered.
83
-
84
- ```css
85
- .modal {
86
- transform-origin: center; /* exempt — not anchored to a trigger */
87
- transition:
88
- opacity 250ms var(--ease-out),
89
- transform 250ms var(--ease-out);
90
- }
91
-
92
- .modal[data-starting-style],
93
- .modal[data-ending-style] {
94
- opacity: 0;
95
- transform: scale(0.96);
96
- }
97
-
98
- .backdrop {
99
- transition: opacity 250ms var(--ease-out);
100
- }
101
- ```
102
-
103
- Animate the backdrop's opacity alongside it so they read as one surface.
104
-
105
- ---
106
-
107
- ## Drawer / sheet
108
-
109
- ```css
110
- .drawer {
111
- transform: translateY(0);
112
- transition: transform 500ms var(--ease-drawer);
113
- }
114
-
115
- .drawer[data-closed] {
116
- transform: translateY(100%);
117
- }
118
- ```
119
-
120
- This is how Vaul hides a drawer before animating it in.
121
-
122
- Add drag and it becomes a gesture problem — see **Drag to dismiss** below.
123
-
124
- ---
125
-
126
- ## Toast
127
-
128
- ```css
129
- .toast {
130
- opacity: 1;
131
- transform: translateY(0);
132
- transition:
133
- opacity 400ms ease,
134
- transform 400ms ease;
135
-
136
- @starting-style {
137
- opacity: 0;
138
- transform: translateY(100%);
139
- }
140
- }
141
- ```
142
-
143
- - `ease` rather than `ease-out`, slightly slower than typical UI: Sonner reads as elegant partly because its motion is tuned to the component's personality rather than to the generic UI budget.
144
- - If `@starting-style` isn't available, fall back to the mount flag:
145
-
146
- ```jsx
147
- useEffect(() => { setMounted(true); }, []);
148
- // <div data-mounted={mounted}>
149
- ```
150
-
151
- When toasts stack and the list reflows, the opacity change has to work against the height change. There's no formula for that pair — adjust until it feels right, then check it again the next day.
152
-
153
- ---
154
-
155
- ## Accordion / collapse
156
-
157
- ```css
158
- .content {
159
- overflow: hidden;
160
- transition:
161
- height 200ms var(--ease-out),
162
- opacity 200ms var(--ease-out);
163
- }
164
- ```
165
-
166
- Keep it short — this is one of the few animations that costs layout on every frame, so a long duration is expensive as well as sluggish. Measure the content height in JS (or use a headless primitive that supplies it) rather than animating to `auto`.
167
-
168
- ---
169
-
170
- ## Stagger a group entrance
171
-
172
- For a list or grid the user sees occasionally — not for a list they scroll past all day.
173
-
174
- ```css
175
- .item {
176
- opacity: 0;
177
- transform: translateY(8px);
178
- animation: fadeIn 300ms var(--ease-out) forwards;
179
- }
180
-
181
- .item:nth-child(2) { animation-delay: 50ms; }
182
- .item:nth-child(3) { animation-delay: 100ms; }
183
- .item:nth-child(4) { animation-delay: 150ms; }
184
-
185
- @keyframes fadeIn {
186
- to {
187
- opacity: 1;
188
- transform: translateY(0);
189
- }
190
- }
191
- ```
192
-
193
- Stagger is decorative — it must never block interaction while it plays.
194
-
195
- ---
196
-
197
- ## Hold to confirm
198
-
199
- For destructive actions where a plain click is too easy to fire by accident.
200
-
201
- ```css
202
- .overlay {
203
- clip-path: inset(0 100% 0 0);
204
- transition: clip-path 200ms var(--ease-out); /* release: snappy */
205
- }
206
-
207
- .button:active .overlay {
208
- clip-path: inset(0 0 0 0);
209
- transition: clip-path 2s linear; /* press: slow and deliberate */
210
- }
211
-
212
- .button:active {
213
- transform: scale(0.97);
214
- }
215
- ```
216
-
217
- `linear` is correct here — the fill is a progress indicator, and progress shouldn't ease.
218
-
219
- ---
220
-
221
- ## Tab indicator with a color transition
222
-
223
- Timing individual color transitions across a tab list never quite lands. Clip instead.
224
-
225
- Duplicate the tab list. Style the copy as the active state — different background, different text color. Clip the copy so only the active tab shows, and animate the clip on change:
226
-
227
- ```css
228
- .tabs-active-copy {
229
- clip-path: inset(0 60% 0 20%); /* driven by the active tab's position */
230
- transition: clip-path 250ms var(--ease-in-out);
231
- }
232
- ```
233
-
234
- The text and background change together, in perfect sync, because they're one element being revealed rather than two colors being interpolated.
235
-
236
- ---
237
-
238
- ## Scroll reveal
239
-
240
- Marketing surfaces only. Don't do this to functional UI a user visits daily.
241
-
242
- ```css
243
- .reveal {
244
- clip-path: inset(0 0 100% 0);
245
- transition: clip-path 600ms var(--ease-in-out);
246
- }
247
-
248
- .reveal[data-visible] {
249
- clip-path: inset(0 0 0 0);
250
- }
251
- ```
252
-
253
- Trigger with `IntersectionObserver`, or Motion's `useInView` with `{ once: true, margin: "-100px" }`. Fire it once — re-animating on every scroll-by is an interface fighting its reader.
254
-
255
- ---
256
-
257
- ## Drag to dismiss
258
-
259
- The gesture recipe. Springs, not durations, because the user can reverse mid-motion.
260
-
261
- ```js
262
- // Dismiss on a flick, not just on distance
263
- const timeTaken = Date.now() - dragStartTime.current;
264
- const velocity = Math.abs(swipeAmount) / timeTaken;
265
-
266
- if (Math.abs(swipeAmount) >= SWIPE_THRESHOLD || velocity > 0.11) {
267
- dismiss();
268
- }
269
- ```
270
-
271
- ```js
272
- // Set transform on the dragged element directly.
273
- // Driving it through a CSS variable on the parent recalcs styles for every child.
274
- element.style.transform = `translateY(${distance}px)`;
275
- ```
276
-
277
- Four details that separate a good drag from a bad one:
278
-
279
- - **Pointer capture** once the drag starts, so it continues when the pointer leaves the element's bounds.
280
- - **Multi-touch protection** — `if (isDragging) return` on new touch points, or switching fingers mid-drag makes the element jump.
281
- - **Damping past boundaries** — dragging beyond a natural edge moves the element less the further it goes. Real things slow before they stop.
282
- - **Friction, not a wall** — allow the over-drag with rising resistance rather than refusing it.
283
-
284
- Settle with a spring so an interrupted drag keeps its velocity:
285
-
286
- ```js
287
- { type: "spring", duration: 0.5, bounce: 0.2 }
288
- ```
289
-
290
- ---
291
-
292
- ## Masking a crossfade that won't settle
293
-
294
- When two states overlap visibly during a transition and no amount of easing or duration tuning fixes it, blur the seam:
295
-
296
- ```css
297
- .content {
298
- transition:
299
- filter 200ms ease,
300
- opacity 200ms ease;
301
- }
302
-
303
- .content.transitioning {
304
- filter: blur(2px);
305
- opacity: 0.7;
306
- }
307
- ```
308
-
309
- Without blur the eye reads two distinct objects swapping. Blur blends them into one perceived transformation. Keep it under 20px — heavy blur is expensive, especially in Safari.
310
-
311
- ---
312
-
313
- ## Programmatic, without a library
314
-
315
- When the motion needs JS control but not a dependency, WAAPI gives you CSS-grade performance:
316
-
317
- ```js
318
- element.animate(
319
- [{ clipPath: 'inset(0 0 100% 0)' }, { clipPath: 'inset(0 0 0 0)' }],
320
- { duration: 1000, fill: 'forwards', easing: 'cubic-bezier(0.77, 0, 0.175, 1)' }
321
- );
322
- ```
323
-
324
- Hardware-accelerated, interruptible, no bundle cost.
@@ -1,281 +0,0 @@
1
- ---
2
- name: animate-expo
3
- description: "Build animation and gestures in React Native and Expo with Reanimated worklets on the UI thread — sheets, drawers, screen transitions, swipe, drag, press feedback, haptics. Use when adding gestures to an Expo app, or when motion stutters, janks or drops frames on a real Android or iOS device."
4
- tags: [motion, animation, expo, react-native, gestures]
5
- recommends: [expo, react-native, animate]
6
- profiles: [full]
7
- origin: emilkowalski (MIT, adapted)
8
- ---
9
-
10
- # Building Animations in Expo
11
-
12
- > **SDD gate.** If this fired on a **new, non-trivial feature or behaviour change** and there is
13
- > **no approved spec + plan** under `02-DOCS/wiki/sdd/`, hand off to `../specify/SKILL.md` first —
14
- > it runs brainstorm → spec → plan → tasks before any code, then routes back here once the plan is
15
- > approved. Build straight from here only for a genuinely one-line / low-risk change, or a bug fix
16
- > restoring intended behaviour. Method: `../sdd/SKILL.md`.
17
-
18
- **Hand-offs.** Web motion is `../animate/SKILL.md`'s — this file exists because mobile changes the
19
- three things listed above. The **Expo platform** itself (router, config plugins, EAS, native modules,
20
- store builds) is `../expo/SKILL.md`'s, and bare React Native app structure is
21
- `../react-native/SKILL.md`'s: both own the app, this one owns its motion. Gesture *physics* as a
22
- discipline — momentum projection, rubber-banding, velocity handoff — is `../apple-design/SKILL.md`'s.
23
-
24
- A construction skill for React Native. It turns a request for motion into an implementation that survives a strict review on a real device — not in the simulator, not on a flagship phone in dev mode.
25
-
26
- Mobile changes three things about animation, and everything in this skill follows from them:
27
-
28
- 1. **There is no hover.** Every affordance the web puts in hover has to live in press, position, or nothing.
29
- 2. **There are two runtimes.** Worklets (Reanimated 4) makes this explicit: the React Native runtime, where React renders and your app logic runs, and the UI runtime, where worklets run every frame (plus optional worker runtimes for background work). An animation that touches the RN runtime stutters the moment the app does anything else. The whole craft is keeping motion on the UI runtime.
30
- 3. **The user's finger is on the element.** Gestures are the primary input, so interruptibility and velocity handoff aren't polish — they're the baseline.
31
-
32
- ## Operating Posture
33
-
34
- You are a senior mobile engineer building the animation yourself. Make the call, state the reasoning in one line, write the code. Never present motion options as a menu.
35
-
36
- Two failure modes, and the first is worse:
37
-
38
- 1. **Animating something that shouldn't animate.** The gate below exists to produce zero lines of code sometimes.
39
- 2. **Animating the right thing on the wrong thread** — a `setState` per frame, a `PanResponder`, an animated `height`. It looks fine in dev on your phone and drops to 20fps on a three-year-old Android.
40
-
41
- ## Hard Rules
42
-
43
- 1. **Run the sequence in order.** Steps 1 and 2 gate everything.
44
- 2. **Reanimated, not core `Animated`.** Core `Animated` can't be driven by a gesture without crossing the bridge, and `useNativeDriver` refuses anything but transform and opacity anyway. Reanimated worklets run on the UI thread and keep running while JS is busy.
45
- 3. **No approximated values.** Curves and spring configs come from the tables below.
46
- 4. **Reduced motion ships with the animation**, not as a follow-up.
47
- 5. **Feel is judged on a release build on the slowest device you support.** Nothing else counts as verified.
48
-
49
- ## The Build Sequence
50
-
51
- ### 1. Should this animate at all?
52
-
53
- | Frequency | Decision |
54
- | --- | --- |
55
- | 100+ times/day — tab switches, keyboard open/close, scrolling, toggles in settings | **No animation.** Platform default or nothing. Stop here. |
56
- | Tens of times/day — press feedback, list navigation, row selection | Near-imperceptible only: under 150ms, or nothing |
57
- | Occasional — sheets, modals, toasts, onboarding steps | Standard animation |
58
- | Rare / first-time — success states, empty-state illustrations, celebration | The delight budget lives here |
59
-
60
- **Tab switches never slide.** Tabs are peers, not a hierarchy — sliding implies depth that isn't there, and the user pays for it dozens of times a session. `animation: 'none'`.
61
-
62
- If the request fails this gate, say so and don't write it.
63
-
64
- ### 2. What is the purpose?
65
-
66
- Name it in one word before continuing: **feedback**, **spatial consistency**, **state indication**, **preventing a jarring change**, **explanation**, or **delight** (rare tier only).
67
-
68
- Can't name it? Don't build it.
69
-
70
- ### 3. Pick the tool — cheapest that works
71
-
72
- Walk down; stop at the first that fits.
73
-
74
- | Need | Tool |
75
- | --- | --- |
76
- | A state-driven change with no gesture — press, toggle, color, a value flipping | **Reanimated CSS transition** (`transitionProperty` in the style) |
77
- | Loop, multi-stage, or plays on mount with no state change | **Reanimated CSS animation** (`animationName` keyframes) |
78
- | An element mounting or unmounting, or a list reflowing | **Layout animations** (`entering` / `exiting` / `itemLayoutAnimation`) |
79
- | Anything a finger touches, or anything derived from scroll | **`useSharedValue` + `Gesture` + `useAnimatedStyle`** |
80
- | Screen to screen | **Native stack options in Expo Router.** Never hand-roll this |
81
- | A bottom sheet that is its own screen | **`presentation: 'formSheet'`** — it's a real UISheetPresentationController, free and correct |
82
- | Tab bar | **`NativeTabs`** (from `expo-router/unstable-native-tabs`) — the platform's real tab bar, its behaviors and transitions included |
83
- | Context menu, press-and-hold preview | **`Link.Menu` / `Link.Preview`** (Expo Router, iOS-only) — native menus and peek, never rebuilt in JS |
84
- | Header that collapses into a large title | **`headerLargeTitleEnabled`** on the native stack (iOS-only; `headerLargeTitle` is deprecated) — not a scroll worklet |
85
- | Pull to refresh | **`RefreshControl`** — hand-roll only when it's a signature interaction (see the threshold recipe) |
86
- | UI that tracks the keyboard | **`react-native-keyboard-controller`** — the keyboard's real position, frame by frame, on the UI thread |
87
- | Vector illustration, celebration, empty state | **Lottie** — for illustration only, never for UI state |
88
- | A huge animated scene, freeform drawing | **`@shopify/react-native-skia`** — a canvas, for when the view hierarchy itself is the bottleneck |
89
-
90
- Reach for a shared value only when the value is continuous or interruptible. A press scale is a CSS transition; a drag is a shared value. Using a worklet for a two-state toggle is the mobile equivalent of installing a motion library for a fade.
91
-
92
- **Dependencies.** Install with `npx expo install <package>` — it resolves the version that matches the project's SDK, which plain `npm install` won't:
93
-
94
- | Need | Package |
95
- | --- | --- |
96
- | Animation | `react-native-reanimated` + `react-native-worklets` |
97
- | Gestures | `react-native-gesture-handler` |
98
- | Navigation, sheets, native tabs, menus | `expo-router` |
99
- | Haptics | `expo-haptics` |
100
- | Keyboard-following UI | `react-native-keyboard-controller` (needs `KeyboardProvider` at the root — see the keyboard recipe) |
101
- | Illustration, celebration | `lottie-react-native` |
102
- | Very large animated scenes, custom drawing | `@shopify/react-native-skia` |
103
-
104
- ### 4. Pick the properties
105
-
106
- - **`transform` and `opacity` are free.** Everything else is a layout pass. `width`, `height`, `margin`, `padding`, `flex`, `top`, `left`, `gap` re-run Yoga on every frame for that node *and its siblings*.
107
- - **The one exception: an absolutely positioned element with no children** — a tab pill, a progress bar fill. It's out of flow, so nothing else re-lays-out, and animating `width` keeps the corner radius that `scaleX` would smear.
108
- - **Never `scale(0)`.** Start from `scale(0.9–0.97)` + `opacity: 0`. Nothing in the real world appears from nothing.
109
- - **`transform` is an array and order matters** — `[{ translateY }, { scale }]` scales after moving; reversed, the translate gets scaled too. Keep translate first unless you want the multiplication.
110
- - **Android shadows are `elevation`, and animating elevation re-renders the shadow every frame.** Animate opacity of a pre-shadowed layer instead.
111
- - **Never animate `BlurView` intensity.** On Android it re-renders the blur each frame. Crossfade the opacity of a static `BlurView` instead.
112
- - **Percentages work in `translate`** and are relative to the element's own size — `translateY('100%')` moves a sheet by its own height whatever its content.
113
-
114
- ### 5. Timing or spring
115
-
116
- **If a finger was involved, use a spring.** Springs carry velocity through an interruption; timing curves restart. Everything else uses timing.
117
-
118
- Reanimated's spring takes Apple's two designer parameters directly — use this form, not mass/stiffness/damping:
119
-
120
- | Interaction | Config |
121
- | --- | --- |
122
- | Default settle, no overshoot | `{ duration: 400, dampingRatio: 1 }` |
123
- | Reposition / snap back after a drag | `{ duration: 400, dampingRatio: 0.8, velocity }` |
124
- | Sheet, drawer | `{ duration: 300, dampingRatio: 0.8, velocity }` |
125
- | Must not pass a hard edge | add `overshootClamping: true` |
126
-
127
- **Bounce only when the gesture carried momentum.** Overshoot on a menu that faded in feels wrong; overshoot on a card you flicked feels right.
128
-
129
- **Easing**, for everything without a finger on it:
130
-
131
- | Situation | Easing |
132
- | --- | --- |
133
- | Entering or exiting | `ease-out` |
134
- | Moving / morphing on screen | `ease-in-out` |
135
- | Constant motion (progress, marquee) | `linear` |
136
- | Default | `ease-out` |
137
-
138
- **Never `ease-in` on UI.** It starts slow, delaying the exact moment the user is watching. Reanimated's built-ins are as weak as CSS's — use these:
139
-
140
- ```js
141
- import { Easing } from 'react-native-reanimated';
142
-
143
- const EASE_OUT = Easing.bezier(0.23, 1, 0.32, 1); // strong ease-out for UI
144
- const EASE_IN_OUT = Easing.bezier(0.77, 0, 0.175, 1); // on-screen movement
145
- const EASE_SHEET = Easing.bezier(0.32, 0.72, 0, 1); // iOS sheet curve
146
- ```
147
-
148
- **Duration:**
149
-
150
- | Element | Duration |
151
- | --- | --- |
152
- | Press feedback | 100–150ms |
153
- | Toggle, chip, small state change | 150–200ms |
154
- | Sheet, modal, drawer | spring, ~300ms perceived |
155
- | Screen transition | the platform default — don't override it |
156
-
157
- Mobile UI animations stay under 300ms, same as web. The platform's own transitions are longer (iOS push is 350ms); match the platform for navigation, beat it everywhere else.
158
-
159
- ### 6. Keep it off the JS thread
160
-
161
- This is the mobile-specific craft, and it's where most React Native motion dies.
162
-
163
- - **Never `setState` from a gesture or scroll handler.** One React render per frame is the single biggest cause of jank in RN apps. Shared value → `useAnimatedStyle`, and React never re-renders at all.
164
- - **Never schedule back to the RN runtime inside `onUpdate` or a scroll handler.** `scheduleOnRN(fn, ...args)` from `react-native-worklets` — the Reanimated 4 replacement for the deprecated `runOnJS(fn)(...args)` — queues an RN-runtime call, and in `onUpdate` that's 60–120× per second. It belongs in `onEnd`, or in a `useAnimatedReaction` that fires when a value crosses a threshold.
165
- - **Never read a shared value during render** (`translateY.get()` in JSX). It's a snapshot that never updates and it silently desyncs. **Never write one during render either** — it fires mid-reconciliation, and a re-render you didn't cause replays the write. Touch shared values only in worklets, handlers, and effects.
166
- - **Use `.get()` / `.set()`, not `.value`.** Same API, but direct `.value` access is the form the React Compiler can't see through — the Reanimated docs call `get`/`set` the compiler-safe way. `set` also takes a functional update: `sv.set((v) => v + 1)`.
167
- - **Functions called from a worklet need `'worklet'`** as their first line, or they throw at runtime on device while working fine in the debugger.
168
-
169
- ### 7. Press, not hover
170
-
171
- Every hover affordance from the web has to be redesigned, not ported.
172
-
173
- - **Feedback on press-in, commit on press-out.** Waiting for the tap to complete before showing anything feels dead — this is the latency the user actually perceives.
174
- - **`scale: 0.97` in 100–150ms** on any pressable, `Pressable` + a CSS transition. `scale` takes the label and icons with it, which is what makes it read as physical.
175
- - **44×44pt minimum touch target** (48dp Android). If the visual is smaller, add `hitSlop` — don't grow the visual.
176
- - **`pressRetentionOffset`** so a finger drifting a few pixels doesn't cancel a press the user meant.
177
- - **Android ripple only in a Material-styled app.** In a custom-designed app, the same scale on both platforms is more coherent than a ripple on one.
178
-
179
- ### 8. Haptics
180
-
181
- Mobile has a sense the web doesn't. Use it sparingly and it becomes the thing that makes the app feel expensive; use it everywhere and users turn it off.
182
-
183
- | Moment | Call |
184
- | --- | --- |
185
- | A value ticks past a step — picker, slider detent, segmented control | `Haptics.selectionAsync()` |
186
- | Something snaps home, a sheet detent catches, a drag commits | `Haptics.impactAsync(ImpactFeedbackStyle.Light)` |
187
- | A heavy object lands, a destructive action fires | `Haptics.impactAsync(ImpactFeedbackStyle.Medium)` |
188
- | Operation succeeded or failed | `Haptics.notificationAsync(NotificationFeedbackType.Success / Error)` |
189
-
190
- Three rules, and they're absolute:
191
-
192
- - **Same frame as the visual.** A haptic that lags its animation reads as a glitch, not as feedback. Fire it at the causal moment — the detent catching — not when the animation finishes.
193
- - **One per user action.** Never on scroll, never per frame, never on an entrance animation the user didn't cause.
194
- - **Never the only feedback.** Haptics are off system-wide for many users, and silent on most Android hardware. The visual has to stand alone.
195
-
196
- From a worklet, haptics must be scheduled back to the RN runtime: `scheduleOnRN(Haptics.selectionAsync)`.
197
-
198
- ### 9. Reduced motion and accessibility
199
-
200
- ```jsx
201
- import { useReducedMotion, ReduceMotion, withSpring } from 'react-native-reanimated';
202
-
203
- const reduced = useReducedMotion();
204
- const y = useSharedValue(reduced ? 0 : SHEET_HEIGHT);
205
-
206
- // or let each animation decide
207
- withSpring(0, { duration: 300, dampingRatio: 0.8, reduceMotion: ReduceMotion.System });
208
- ```
209
-
210
- Reduced motion means **fewer and gentler**, not zero: keep opacity and color changes that explain a state change, drop translation, scale, parallax and overshoot. Screen transitions become `animation: 'fade'`.
211
-
212
- **Text scales.** `allowFontScaling` is on by default, so any height you measured at default type size is wrong at 200%. Never animate to a hardcoded height — measure with `onLayout`, or animate a transform instead.
213
-
214
- ## Setup that silently breaks motion
215
-
216
- Check these first when "the animation just doesn't run":
217
-
218
- - Install through Expo so versions match the SDK: `npx expo install react-native-reanimated react-native-worklets`. In an Expo project, `babel-preset-expo` configures the worklets Babel plugin automatically — no `babel.config.js` step. Only a bare RN project without that preset adds the plugin manually, and there it must be last in the list. A missing or misplaced plugin doesn't silently fall back anymore — it throws `Failed to create a worklet` at runtime.
219
- - `GestureHandlerRootView` must wrap the app, or gestures do nothing with no error.
220
- - Reanimated 4 requires the New Architecture.
221
- - **Expo Go is not a performance environment.** Judge feel in a release build; a dev build's JS thread is slow enough to hide exactly the problems you're looking for.
222
-
223
- ## 120fps
224
-
225
- On ProMotion iPhones, third-party animations are capped at 60fps unless `CADisableMinimumFrameDurationOnPhone` is set. Recent Expo SDKs set it by default — confirm it's there, and add it if not:
226
-
227
- ```json
228
- { "expo": { "ios": { "infoPlist": { "CADisableMinimumFrameDurationOnPhone": true } } } }
229
- ```
230
-
231
- Then the frame budget is 8ms, not 16. This is also why a UI-thread animation matters more on mobile than it does on web.
232
-
233
- ## Recipes
234
-
235
- For ready-to-build implementations — press feedback, drag-to-dismiss sheet, swipe-to-delete, collapsing header, list entrances, keyboard-synced UI, tab indicator, screen transitions — see [references/recipes.md](references/recipes.md). Load it whenever the request matches one; start from the recipe rather than from a blank file.
236
-
237
- ## Never Ship
238
-
239
- | Never | Instead |
240
- | --- | --- |
241
- | `PanResponder` | `Gesture.Pan()` from gesture-handler |
242
- | `setState` in a gesture or scroll handler | shared value + `useAnimatedStyle` |
243
- | `runOnJS` (deprecated in Reanimated 4) | `scheduleOnRN` from `react-native-worklets` |
244
- | `scheduleOnRN` per frame | `onEnd`, or `useAnimatedReaction` at a threshold |
245
- | Reading or writing a shared value during render | `.get()` / `.set()` in worklets, handlers, effects |
246
- | Core `Animated` for anything a finger touches | Reanimated |
247
- | Animating `height` / `width` / `margin` / `flex` / `top` | `transform` + `opacity` (absolute, childless elements exempt) |
248
- | Animating `BlurView` intensity or Android `elevation` | crossfade a static layer |
249
- | `entering` on a virtualized list row | animate the container, or `itemLayoutAnimation` |
250
- | A screen transition rebuilt in JS | native stack `animation` |
251
- | Sliding between tabs | `animation: 'none'` |
252
- | `Easing.in(...)` on a UI element | `Easing.bezier(0.23, 1, 0.32, 1)` |
253
- | `scale(0)` entrance | `scale(0.95)` + `opacity: 0` |
254
- | Distance-only dismissal threshold | velocity **or** distance — a flick is enough |
255
- | Hard stop at a boundary | rubber-band resistance |
256
- | A haptic per frame, or as the only feedback | one per commit, always paired with a visual |
257
- | Judging feel in Expo Go or the simulator | release build, slowest supported device |
258
-
259
- ## Output
260
-
261
- Write the code. Then, in at most a few lines:
262
-
263
- - **The gate result** — frequency tier and named purpose. Say what you rejected and why.
264
- - **The ingredients** — tool, properties, spring or curve + duration, thread.
265
- - **What to feel-check on device** — gestures, velocity handoff and haptic timing cannot be judged from code. Name what to try: flick it, interrupt it mid-flight, reverse it, run it on the slowest Android you have.
266
-
267
- The code is the deliverable. Don't pad it into a report.
268
-
269
- ## Tone
270
-
271
- Opinionated and brief. When the honest answer is "this shouldn't animate," or "this needs a real device before I can tell you if it's right," give it.
272
-
273
- ---
274
-
275
- ## Credit
276
-
277
- Adapted for the rsc catalog from **[emilkowalski/skills](https://github.com/emilkowalski/skills)**
278
- (MIT, commit `d23d7f8`) by Emil Kowalski — the design-engineering and animation philosophy behind
279
- [Sonner](https://sonner.emilkowal.ski), [Vaul](https://vaul.emilkowal.ski) and
280
- [animations.dev](https://animations.dev). The craft bar here is his; the routing, gates and evals
281
- that make it an rsc skill are not. Nothing in this body is a substitute for his course.
@@ -1,36 +0,0 @@
1
- skill: animate-expo
2
-
3
- should_trigger:
4
- - prompt: "Animate this bottom sheet in our Expo app so the drag feels native on Android."
5
- why: "Expo gesture-driven motion; the skill's core use case."
6
- - prompt: "Add press feedback and haptics to the buttons in our React Native app."
7
- why: "Press feedback plus expo-haptics, both named in the description."
8
- - prompt: "This animation stutters on a real device but looks fine in the simulator."
9
- why: "The named symptom of motion crossing to the React Native runtime instead of staying on the UI runtime."
10
- - prompt: "Set up a swipe-to-dismiss gesture with Reanimated and Gesture Handler."
11
- why: "Reanimated and Gesture Handler are this skill's tools by name."
12
- - prompt: "Make the screen transitions in our Expo Router app feel smoother."
13
- why: "Screen transitions with Expo Router, explicitly in scope."
14
- - prompt: "Our list scroll drops frames on a three-year-old Android phone."
15
- why: "The mobile performance failure mode the skill exists to prevent (main-thread animation)."
16
-
17
- should_not_trigger:
18
- - prompt: "Animate this dropdown on our marketing site so it opens with the right easing."
19
- route_to: "animate"
20
- why: "Web motion: hover exists, CSS is the default engine."
21
- - prompt: "Set up EAS Build and submit the app to the App Store with an OTA update channel."
22
- route_to: "expo"
23
- why: "Platform and shipping concerns, not motion."
24
- - prompt: "Restructure the navigation and offline state in our React Native screens."
25
- route_to: "react-native"
26
- why: "App code and architecture, not animation."
27
- - prompt: "Explain how momentum projection and velocity handoff work as a discipline."
28
- route_to: "apple-design"
29
- why: "The physics as a subject belongs to apple-design; this skill applies it in Expo."
30
- - prompt: "Write the Swift concurrency layer for the native module this app calls."
31
- route_to: "write-swift"
32
- why: "Swift language work, not React Native motion."
33
-
34
- capability:
35
- - scenario: "User asks to animate a tab bar that users tap dozens of times per session, in an Expo app."
36
- expect: "Applies the frequency gate before choosing tools: a tens-of-times-a-day action gets near-imperceptible motion or none, and the answer says so. If it does animate, the work stays on the UI runtime (worklets, not setState per frame) and ships reduced-motion handling with it."