react-native-design
它能做什么
这个工具可以帮你打造同时适用于 iPhone 和 Android 手机的移动应用的外观、交互感受和行为。你可以用它来安排页面、制作流畅的动画,并为界面元素设置样式。
适用场景
- ✓当你要开发一款同时支持 iPhone 和 Android 的移动应用时。
- ✓当你希望应用中的页面之间能够相互衔接时。
- ✓当你想让应用中的动画既流畅又迅速时。
技能链接
https://github.com/wshobson/agents/blob/main/plugins/ui-design/skills/react-native-design/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“我想让移动应用里的按钮在用户按下时轻微缩小,该怎么实现?”
每周 5 个新技能,1 分钟读完。
工作原理
它会使用特定的库来制作应用的视觉元素和动画。这些库能确保应用在不同手机上都运行得流畅、迅速。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
React Native Design
Master React Native styling patterns, React Navigation, and Reanimated 3 to build performant, cross-platform mobile applications with native-quality user experiences.
When to Use This Skill
- Building cross-platform mobile apps with React Native
- Implementing navigation with React Navigation 6+
- Creating performant animations with Reanimated 3
- Styling components with StyleSheet and styled-components
- Building responsive layouts for different screen sizes
- Implementing platform-specific designs (iOS/Android)
- Creating gesture-driven interactions with Gesture Handler
- Optimizing React Native performance
Detailed section: Core Concepts
Originally a 6471-byte section in this SKILL.md. Moved to references/details.md to fit Codex's 8 KB skill body cap.
Quick Start Component
import React from 'react';
import {
View,
Text,
StyleSheet,
Pressable,
Image,
} from 'react-native';
import Animated, {
useSharedValue,
useAnimatedStyle,
withSpring,
} from 'react-native-reanimated';
interface ItemCardProps {
title: string;
subtitle: string;
imageUrl: string;
onPress: () => void;
}
const AnimatedPressable = Animated.createAnimatedComponent(Pressable);
export function ItemCard({ title, subtitle, imageUrl, onPress }: ItemCardProps) {
const scale = useSharedValue(1);
const animatedStyle = useAnimatedStyle(() => ({
transform: [{ scale: scale.value }],
}));
return (
<AnimatedPressable
style={[styles.card, animatedStyle]}
onPress={onPress}
onPressIn={() => { scale.value = withSpring(0.97); }}
onPressOut={() => { scale.value = withSpring(1); }}
>
<Image source={{ uri: imageUrl }} style={styles.image} />
<View style={styles.content}>
<Text style={styles.title} numberOfLines={1}>
{title}
</Text>
<Text style={styles.subtitle} numberOfLines={2}>
{subtitle}
</Text>
</View>
</AnimatedPressable>
);
}
const styles = StyleSheet.create({
card: {
backgroundColor: '#ffffff',
borderRadius: 16,
overflow: 'hidden',
shadowColor: '#000',
shadowOffset: { width: 0, height: 2 },
shadowOpacity: 0.1,
shadowRadius: 8,
elevation: 4,
},
image: {
width: '100%',
height: 160,
backgroundColor: '#f3f4f6',
},
content: {
padding: 16,
gap: 4,
},
title: {
fontSize: 18,
fontWeight: '600',
color: '#1f2937',
},
subtitle: {
fontSize: 14,
color: '#6b7280',
lineHeight: 20,
},
});
Best Practices
- Use TypeScript: Define navigation and prop types for type safety
- Memoize Components: Use
React.memoanduseCallbackto prevent unnecessary rerenders - Run Animations on UI Thread: Use Reanimated worklets for 60fps animations
- Avoid Inline Styles: Use StyleSheet.create for performance
- Handle Safe Areas: Use
SafeAreaVieworuseSafeAreaInsets - Test on Real Devices: Simulator/emulator performance differs from real devices
- Use FlatList for Lists: Never use ScrollView with map for long lists
- Platform-Specific Code: Use Platform.select for iOS/Android differences
Common Issues
- Gesture Conflicts: Wrap gestures with
GestureDetectorand usesimultaneousHandlers - Navigation Type Errors: Define
ParamListtypes for all navigators - Animation Jank: Move animations to UI thread with
runOnUIworklets - Memory Leaks: Cancel animations and cleanup in useEffect
- Font Loading: Use
expo-fontorreact-native-assetfor custom fonts - Safe Area Issues: Test on notched devices (iPhone, Android with cutouts)
常见问题
什么是 React Native?
它是一种用于开发移动应用的方式,使用的代码也可以用于网站开发,让同一套代码既能在 iPhone 上运行,也能在 Android 上运行。
什么是高性能动画?
指运行非常流畅、迅速的动画,即使在配置较低的手机上,也不会让应用卡顿。
“跨平台”是什么意思?
指应用可以在不同的操作系统上运行,比如 iOS(iPhone)和 Android,无需为每个系统重写代码。
详情
作者的原始描述
Master React Native styling, navigation, and Reanimated animations for cross-platform mobile development. Use when building React Native apps, implementing navigation patterns, or creating performant animations.
repo: wshobson/agents
热度
- GitHub 星标
- 41k
- 排名
- #6806
- 许可证
- MIT
- 更新时间
- 2026/10/15
评论
- …