react-native-reanimated
安装方式
先用 Prompt 核对来源与依赖。也可下载安装包。
用 AI 助手安装
复制提示词,让助手先核对固定版本和依赖。
查看 Prompt收起 Prompt
先检查当前 Agent 是否已安装 SkillPI Skill Finder。如果尚未安装,请按官方仓库的说明安装并启用:https://github.com/Findskills/skillpi。然后使用 Skill Finder 打开此 SkillPI 详情页并定位 "react-native-reanimated":https://skillpi.com/zh/skills/deepskill-4966f67ea4596315e0ee3898814b8921c7cc5cd7811b4bad47694ab873a87b1b。安装前核对上游来源和版本:https://github.com/TerminalSkills/skills。来源不一致时停止并说明差异。核对通过后,用 Skill Finder 安装目标 Skill,并报告安装路径和来源版本。
来源与配置
github.com
配置方式待核实
请查看原始来源中的适用工具、依赖和权限要求。
安装实测待补充
用于在 React Native 中使用 Reanimated 构建流畅的 60fps 动画,使动画在 UI 线程上运行以避免 JS 桥接延迟。适用于询问“在 React Native 中实现动画”、“Reanimated”、“流畅的移动动画”、“手势动画”、“共享元素过渡”或“60fps React Native 动画”等场景,涵盖 worklets、共享值、布局动画、手势和滚动驱动动画等内容。
介绍来源: third_party · TerminalSkills · 1.0.0 参考来源
SkillPi 解读
- 适合谁
- 翻译待完成,请参阅来源文档。
- 实测状态
- 未测试
文件浏览
Frontmatter
name: react-native-reanimated
description: >-
Build smooth 60fps animations in React Native with Reanimated — run animations
on the UI thread without JS bridge delays. Use when someone asks to "animate
in React Native", "Reanimated", "smooth mobile animations", "gesture
animations", "shared element transitions", or "60fps React Native
animations". Covers worklets, shared values, layout animations, gestures,
and scroll-driven animations.
license: Apache-2.0
compatibility: "React Native / Expo. iOS + Android."
metadata:
author: terminal-skills
version: "1.0.0"
category: development
tags: ["react-native", "animation", "reanimated", "gestures", "ui"]React Native Reanimated
Overview
Reanimated runs animations on the native UI thread — no JS bridge bottleneck, no dropped frames. Animations stay at 60fps even when your JavaScript thread is busy. It uses "worklets" — small JavaScript functions that execute on the UI thread via JSI. The standard for production-quality animations in React Native: gesture-driven interactions, layout transitions, scroll-based effects, and shared element transitions.
When to Use
- Any animation in React Native beyond simple opacity/transform
- Gesture-driven interactions (swipe to delete, drag to reorder, pinch to zoom)
- Scroll-driven animations (parallax headers, sticky elements)
- Layout animations (items entering/leaving lists)
- Shared element transitions between screens
Instructions
Setup
npx expo install react-native-reanimated react-native-gesture-handler
// babel.config.js — Add the Reanimated plugin (MUST be last)
module.exports = function (api) {
api.cache(true);
return {
presets: ["babel-preset-expo"],
plugins: ["react-native-reanimated/plugin"], // Must be last!
};
};
Shared Values and Animated Styles
// components/FadeIn.tsx — Basic animation with shared values
import Animated, {
useSharedValue,
useAnimatedStyle,
withTiming,
withSpring,
} from "react-native-reanimated";
import { useEffect } from "react";
export function FadeInCard({ children }) {
const opacity = useSharedValue(0);
const translateY = useSharedValue(20);
useEffect(() => {
opacity.value = withTiming(1, { duration: 600 });
translateY.value = withSpring(0, { damping: 15 });
}, []);
const animatedStyle = useAnimatedStyle(() => ({
opacity: opacity.value,
transform: [{ translateY: translateY.value }],
}));
return (
<Animated.View style={animatedStyle} className="bg-white rounded-xl p-4 shadow-lg">
{children}
</Animated.View>
);
}
Gesture Animations
// components/SwipeToDelete.tsx — Swipe gesture with animation
import Animated, {
useSharedValue,
useAnimatedStyle,
withSpring,
runOnJS,
} from "react-native-reanimated";
import { Gesture, GestureDetector } from "react-native-gesture-handler";
export function SwipeToDelete({ onDelete, children }) {
const translateX = useSharedValue(0);
const pan = Gesture.Pan()
.onUpdate((event) => {
// Only allow left swipe
translateX.value = Math.min(0, event.translationX);
})
.onEnd((event) => {
if (event.translationX < -150) {
// Swipe far enough — delete
translateX.value = withSpring(-400);
runOnJS(onDelete)();
} else {
// Snap back
translateX.value = withSpring(0);
}
});
const animatedStyle = useAnimatedStyle(() => ({
transform: [{ translateX: translateX.value }],
}));
return (
<GestureDetector gesture={pan}>
<Animated.View style={animatedStyle}>
{children}
</Animated.View>
</GestureDetector>
);
}
Layout Animations
// components/AnimatedList.tsx — Items animate in/out automatically
import Animated, { FadeInDown, FadeOutLeft, LinearTransition } from "react-native-reanimated";
export function AnimatedList({ items, onRemove }) {
return (
<Animated.FlatList
data={items}
itemLayoutAnimation={LinearTransition}
renderItem={({ item, index }) => (
<Animated.View
entering={FadeInDown.delay(index * 100).springify()}
exiting={FadeOutLeft.duration(300)}
className="bg-white p-4 mx-4 my-1 rounded-lg"
>
<Text>{item.title}</Text>
<Pressable onPress={() => onRemove(item.id)}>
<Text className="text-red-500">Remove</Text>
</Pressable>
</Animated.View>
)}
/>
);
}
Scroll-Driven Animations
// components/ParallaxHeader.tsx — Parallax effect on scroll
import Animated, {
useAnimatedScrollHandler,
useSharedValue,
useAnimatedStyle,
interpolate,
} from "react-native-reanimated";
export function ParallaxHeader() {
const scrollY = useSharedValue(0);
const scrollHandler = useAnimatedScrollHandler({
onScroll: (event) => {
scrollY.value = event.contentOffset.y;
},
});
const headerStyle = useAnimatedStyle(() => ({
height: interpolate(scrollY.value, [-100, 0, 200], [400, 300, 100]),
opacity: interpolate(scrollY.value, [0, 200], [1, 0.3]),
transform: [
{ translateY: interpolate(scrollY.value, [0, 200], [0, -50]) },
],
}));
return (
<>
<Animated.View style={headerStyle} className="bg-blue-600">
<Text className="text-white text-3xl font-bold">My App</Text>
</Animated.View>
<Animated.ScrollView onScroll={scrollHandler} scrollEventThrottle={16}>
{/* Content */}
</Animated.ScrollView>
</>
);
}
Examples
Example 1: Build a card swipe interface
User prompt: "Build a Tinder-style card swipe interface with smooth animations."
The agent will create a card stack with pan gestures, rotation based on swipe direction, spring animations for snap-back, and layout transitions for card removal.
Example 2: Animated bottom sheet
User prompt: "Create a bottom sheet that can be dragged up and snaps to positions."
The agent will use pan gestures with snap points, shared values for height, and spring animations for smooth snapping.
Guidelines
- Shared values for animation state —
useSharedValueruns on UI thread useAnimatedStylefor dynamic styles — recalculated on UI threadwithSpringfor natural motion —withTimingfor precise durationrunOnJSto call JS from worklets — bridge back to JS thread when needed- Gesture Handler integration —
Gesture.Pan(),Gesture.Pinch(), etc. - Layout animations are declarative —
entering,exitingprops on Animated components interpolatefor value mapping — map scroll position to opacity, scale, etc.- Babel plugin must be last —
react-native-reanimated/pluginat end of plugins array - Don't access JS objects in worklets — only shared values and primitives
scrollEventThrottle={16}— 60fps scroll events for smooth animations
当前收录版本
1.0.0
质量评测
满分100 · 来自 SkillPi LAB 实验室的评测报告。
亮点
- 提供 React Native 中高性能动画的完整解决方案,覆盖共享值、手势、布局、滚动驱动等核心场景
- 适用于移动开发中的高频动画需求,具有明确的实用价值和广泛受众
亮点
- 触发词覆盖全面且精准,包括 'Reanimated'、'gesture animations'、'60fps React Native animations' 等关键变体
- 边界清晰,不易与其他 Skill 重叠或误触
亮点
- 文档结构清晰完整,包含从 Setup 到具体动画类型的详细 Instructions 和端到端代码示例
- frontmatter 完整,章节划分合理,符合 Skill 规范要求
亮点
- 工具来源明确,参数配置正确,覆盖主要异常场景(如 swipe 距离判断、snap back 逻辑)
- 不可逆操作有确认机制,代码示例可直接执行
取前四项原始分值的算术平均,四舍五入取整。可通过收录报告核对各项评分与说明,运行记录需单独查证。
正文静态检测
100 / 100 · skillpi-20261123-no-r3-v1
正文未命中当前规则。
分数仅反映正文中的规则命中,供使用前参考。附件与运行行为不在此评分范围内。
权限与使用前检查
根据当前主文档自动整理,命中内容可能是示例或防护说明;不是实际权限声明,也未覆盖附件、外部依赖或运行行为。
-
安装或获取外部依赖
使用官方来源并锁定版本,在隔离环境检查安装脚本。当前文档检查不覆盖后续下载的代码。
主文档提及 · 第 38 行
安全评级与访问范围
safe · 静态证据核验,不代表运行安全保证。
使用前请由宿主核对并授权实际文件读写、外部服务和联网目的地;本站的核验不会授予任何运行权限。
用户讨论
还没有已核实的点评。