Skip to content
Agentmart
Submit a tool

reanimated-core

Reanimated core — useSharedValue, useAnimatedStyle, useDerivedValue, useAnimatedReaction, useAnimatedProps, worklet rules, UI vs JS thread, runOnUI/runOnJS…

Skill by hzblj

IndexedMIT★ 1
Write a review

Install

Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.

npx agentmarket install skill/hzblj-reanimated-core

Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.

Get the weekly diff

The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.

We use your email only for this newsletter. Privacy

About

Reanimated core — useSharedValue, useAnimatedStyle, useDerivedValue, useAnimatedReaction, useAnimatedProps, worklet rules, UI vs JS thread, runOnUI/runOnJS, and the .value-only-in-worklets rule. Triggers on: shared value, useAnimatedStyle, worklet, runOnJS, UI thread, .value in render.

Use cases: design

No reviews yet. Installed it? Reviews come from verified installers only. How reviews work

Permissions

What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.

Tools
No tools found
Secrets
None asked for
Install scripts
None found

Network hosts it talks to 1

  • codeload.github.com · found in install command

Files it touches

  • ~/.claude/skills/reanimated-core

What's inside

Skill name
reanimated-core
Description
Reanimated core — useSharedValue, useAnimatedStyle, useDerivedValue, useAnimatedReaction, useAnimatedProps, worklet rules, UI vs JS thread, runOnUI/runOnJS, and the .value-only-in-worklets rule. Triggers on: shared value, useAnimatedStyle, worklet, runOnJS, UI thread, .value in render.
License
MIT
Instructions
224 lines in SKILL.md · view on GitHub

Agent Skills spec issues

  • name: "reanimated-core" does not match folder "core"

Files (2)

  • SKILL.md
  • openai.yaml · agents/

SKILL.md (first lines)

# Core Hooks & the Worklet Model

The foundation of every Reanimated animation: shared values, worklets, and the two-thread model. Get this right and everything else composes cleanly.

## The two-thread model

React Native runs your JS logic on the **JS thread**. Reanimated runs animations on the **UI thread** via *worklets* — small functions that are copied to a separate JS runtime on the UI thread and executed there, in sync with the display's refresh rate.

| | JS thread | UI thread (worklets) |
| --- | --- | --- |
| **Runs** | React render, effects, event handlers, business logic | `useAnimatedStyle`, `useDerivedValue`, gesture callbacks, functions marked `'worklet'` |
| **Blocked by** | Heavy JS work, list rendering, network parsing | Nothing you write should block it — keep worklets tiny |
| **Frame budget** | Not frame-critical | 16.6ms @ 60fps, 8.3ms @ 120fps ProMotion |
| **Can call** | `runOnUI` to schedule worklets | `runOnJS` to call back into JS-only code |

Shared values are the bridge: they can be read/written from both threads, and mutating one on the UI thread never round-trips through React.

Keep all motion on the UI thread: everything that animates must run in a worklet (`useAnimatedStyle`, `useDerivedValue`, gesture callbacks). Never `setState` on every frame to drive motion — that hops to the JS thread and drops frames.

## The golden rule: never touch `.value` during render

Read and write `shared.value` **only** inside:

- worklets (functions with the `'worklet'` directive),
- `useAnimatedStyle` / `useAnimatedProps` / `useDerivedValue` callbacks,
- `useAnimatedReaction`,
- gesture callbacks (`onBegin`/`onUpdate`/`onEnd`),
- `useEffect` / event handlers (JS thread — fine to write, e.g. `sv.value = withTiming(1)`).

Never read or write it in the component render body.

```tsx
// Bad — reading .value during render
const Box = () => {
  const width = useSharedValue(100);
  return <View style={{ width: width.value }} />; // ❌ no subscription, warns/crashes
}
```

```tsx
// Good — read .value inside an animated style worklet
const Box = () => {
  const width = useSharedValue(100);
  const style = useAnimatedStyle(() => ({ width: width.value }));
  return <Animated.View style={style} />;
}
```

## `useSharedValue`

A mutable value that lives on the UI thread and drives animations. Mutating `.value` does **not** trigger a React re-render.

```tsx
import { useSharedValue, withSpring } from 'react-native-reanimated';
import { SPRING } from './constants';

const scale = useSharedValue(1);

// Writing from the JS thread (event handler) is fine:
const onPressIn = () => { scale.value = withSpring(0.96, SPRING); };
const onPressOut = () => { scale.value = withSpring(1, SPRING); };
```

## `useAnimatedStyle`

Returns a style object computed on the UI thread. Reanimated auto-tracks any shared value you read inside — there is no manual dependency array.

```tsx
// Good — animate transform + opacity (composited, no layout pass)
const style = useAnimatedStyle(() => ({
  transform: [{ scale: scale.value }],
  opacity: opacity.value,
}));

return <Animated.View style={[styles.card, style]} />;
```

```tsx
// Bad — animating layout props triggers a layout pass every frame → jank
const style = useAnimatedStyle(() => ({
  width: width.value,
  marginTop: offset.value,
}));
```

The callback is an implicit worklet — you do **not** write `'worklet'` inside hook callbacks; Reanimated's Babel plugin adds it.

## `useDerivedValue`

Compute a new shared value from others on the UI thread. Use it to keep derivation off the JS thread and avoid duplicated math across styles.

```tsx
// Good — derive once, consume in multiple styles
const progress = useSharedValue(0);
const opacity = useDerivedValue(() => progress.value);         // 0 → 1
const translateY = useDerivedValue(() => (1 - progress.value) * 20);

const style = useAnimatedStyle(() => ({
  opacity: opacity.value,
  transform: [{ translateY: translateY.value }],
}));
```

## `useAnimatedReaction`

Run a side effect on the UI thread when a computed value changes — the UI-thread equivalent of "watch this, then do that". Great for triggering a second animation, or hopping to JS with `runOnJS` at a threshold.

```tsx
// Good — fire haptics on the JS thread when a drag crosses a threshold
useAnimatedReaction(
  () => translateX.value > SWIPE_THRESHOLD,   // prepare (worklet)
  (isPastThreshold, wasPastThreshold) => {     // react (worklet)
    if (isPastThreshold && !wasPastThreshold) {
      runOnJS(triggerHaptic)();
    }
  },
);
```

From hzblj/skills, MIT.

More from hzblj/skills

Signals

Stars
1
Forks
0
Open issues
0
Last commit (this folder)
Jul 15, 2026 (3 months ago)
Last release
Aug 19, 2026 (2 months ago)

From GitHub (fetched Oct 24, 2026).

Details

License
MIT
First seen
Oct 24, 2026
Last checked
Oct 24, 2026

More from hzblj

Cite this page

reanimated-core skill. Agent Mart. https://agentmart.dev/skills/hzblj-reanimated-core (last updated 2026-10-24)