Index of every page on this site: llms.txt
All skills
tristanmanchester avatar

/animating-react-native-expo

@3323bc9
Run it yourself

Implement and debug React Native or Expo motion with Reanimated 4 and Gesture Handler 3: state transitions, layout, gestures, scroll, worklets, cancellation, and accessible alternatives. Use for native UI motion, not web Motion or a reason to add canvas graphics to ordinary views.

Use this Skill: https://skilld.dev/gh/tristanmanchester/agent-skills/animating-react-native-expo

Nothing lands on disk. Nothing to clean up.

Fork this Skill

Edit a local copy. It keeps the author and licence.

referencesworklets-and-threading.md

≈616 tokens on demand. Your agent reads this file only when SKILL.md points to it.

Worklets & threading (Reanimated 4)

Mental model

  • RN Runtime: “normal JS thread” (React state, navigation, network, etc.).
  • UI Runtime: a separate JS runtime used to run worklets on the UI thread.

Reanimated uses worklets to calculate styles and react to events on the UI thread.

Reference: https://docs.swmansion.com/react-native-reanimated/docs/guides/worklets/

Defining worklets

Mark a function with a 'worklet' directive.

function clamp01(x: number) {
  'worklet';
  return Math.max(0, Math.min(1, x));
}

Most Reanimated hooks (e.g. useAnimatedStyle) and Gesture Handler callbacks are workletised automatically.

Scheduling across threads

Run a worklet on the UI runtime

Use scheduleOnUI when you need to manually hop to UI.

Run JS from a worklet (UI → RN)

Use scheduleOnRN.

import { scheduleOnRN } from 'react-native-worklets';

function Example({ onDone }: { onDone: () => void }) {
  // onDone is JS (RN runtime)
  const tap = Gesture.Tap().onEnd(() => {
    // worklet (UI runtime)
    scheduleOnRN(onDone);
  });
}

Important constraint (from the docs): functions passed to scheduleOnRN must be defined in RN-runtime scope (module scope or the component body). Don’t create them inside a worklet/animation callback.

Docs: https://docs.swmansion.com/react-native-reanimated/docs/guides/worklets/

Migration notes (Reanimated 3 → 4)

Reanimated 4 moves worklet/threading helpers into react-native-worklets:

  • runOnJS → scheduleOnRN
  • runOnUI → scheduleOnUI
  • executeOnUIRuntimeSync → runOnUISync

Also update Babel plugin:

  • react-native-reanimated/plugin → react-native-worklets/plugin

Migration guide: https://docs.swmansion.com/react-native-reanimated/docs/guides/migration-from-3.x/

Closure capture: avoid accidental “big object” capture

Worklets capture only referenced variables, but referencing a property of a big object can still capture the whole object. The docs recommend extracting primitives first.

// BAD: theme is huge; referencing theme.color can capture the whole object
const theme = getTheme();
const style = useAnimatedStyle(() => ({ backgroundColor: theme.color }));

// GOOD: capture only the primitive
const theme = getTheme();
const bg = theme.color;
const style = useAnimatedStyle(() => ({ backgroundColor: bg }));

Docs: https://docs.swmansion.com/react-native-reanimated/docs/guides/worklets/

Source: SKILL.md on GitHub

No rule matched.

skilld matched fixed text patterns in SKILL.md and file names. Patterns miss obfuscated code.

skilld run checks every file with the same patterns. It asks for approval before it loads a Skill with a behavior marked Needs approval.

1 warning1mo5 checks · Risk SAFE
  • Gen Agent Trust Hub1mo

    This skill provides documentation, code examples, and a diagnostic script for implementing animations in React Native (Expo) apps using Reanimated v4 and Gesture Handler. No malicious patterns or security risks were detected.

  • Socket1mo

    No alerts

  • Snyk1mo

    Risk: LOW · No issues

  • Runlayer8mo

    9/9 files flagged

  • ZeroLeaks6mo

    Score: 93/100 · 2 sections analyzed

Signed by skilld at 3323bc9. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 2 weeks ago.

Steadyupdated last month
metadata
{
  "version": "2.0.0",
  "reviewed": "2026-09-13"
}
Other metadata
compatibility
Requires a compatible React Native New Architecture, Reanimated 4, Worklets, and Gesture Handler 3 stack. Resolve versions through the app's Expo SDK or upstream compatibility tables; native verification needs a device or simulator build.

README badge

README badge for tristanmanchester/agent-skills/animating-react-native-expo