安装方式
命令行安装
在项目根目录执行以下命令,完成 Skill 安装。
npx bzskills add vercel-labs/agent-skills --skill vercel-react-native-skills React Native 和 Expo 最佳实践,用于构建高性能移动应用。在构建 React Native 组件、优化列表性能、实现动画或使用原生模块时适用。适用于涉及 React Native、Expo、移动性能或原生平台 API 的任务。
111.4k
下载量
命令行安装
在项目根目录执行以下命令,完成 Skill 安装。
npx bzskills add vercel-labs/agent-skills --skill vercel-react-native-skills name: vercel-react-native-skills
description: React Native 和 Expo 最佳实践,用于构建高性能移动应用。在构建 React Native 组件、优化列表性能、实现动画或使用原生模块时适用。适用于涉及 React Native、Expo、移动性能或原生平台 API 的任务。
license: MIT
metadata:
author: vercel
version: '1.0.0'React Native 和 Expo 应用程序的综合最佳实践。包含跨多个类别的规则,涵盖性能、动画、UI 模式以及平台特定优化。
在以下情况下参考这些指南:
| 优先级 | 类别 | 影响 | 前缀 |
|---|---|---|---|
| 1 | 列表性能 | 严重 | list-performance- |
| 2 | 动画 | 高 | animation- |
| 3 | 导航 | 高 | navigation- |
| 4 | UI 模式 | 高 | ui- |
| 5 | 状态管理 | 中 | react-state- |
| 6 | 渲染 | 中 | rendering- |
| 7 | 单体仓库 | 中 | monorepo- |
| 8 | 配置 | 低 | fonts-, imports- |
list-performance-virtualize - 对大型列表使用 FlashListlist-performance-item-memo - 对列表项组件进行记忆化list-performance-callbacks - 稳定回调引用list-performance-inline-objects - 避免内联样式对象list-performance-function-references - 将函数提取到渲染之外list-performance-images - 优化列表中的图片list-performance-item-expensive - 将耗时操作移出列表项list-performance-item-types - 对异构列表使用 item 类型animation-gpu-properties - 仅对 transform 和 opacity 进行动画animation-derived-value - 对计算动画使用 useDerivedValueanimation-gesture-detector-press - 使用 Gesture.Tap 代替 Pressablenavigation-native-navigators - 使用原生堆栈和原生标签页代替 JS 导航器ui-expo-image - 所有图片使用 expo-imageui-image-gallery - 图片灯箱使用 Galeriaui-pressable - 使用 Pressable 代替 TouchableOpacityui-safe-area-scroll - 在 ScrollView 中处理安全区域ui-scrollview-content-inset - 为头部使用 contentInsetui-menus - 使用原生上下文菜单ui-native-modals - 尽可能使用原生模态框ui-measure-views - 使用 onLayout,不要用 measure()ui-styling - 使用 StyleSheet.create 或 Nativewindreact-state-minimize - 最小化状态订阅react-state-dispatcher - 对回调使用分发器模式react-state-fallback - 首次渲染时显示降级内容react-compiler-destructure-functions - 为 React Compiler 进行解构react-compiler-reanimated-shared-values - 配合编译器处理共享值rendering-text-in-text-component - 将文本包裹在 Text 组件中rendering-no-falsy-and - 避免使用 falsy && 进行条件渲染monorepo-native-deps-in-app - 将原生依赖保留在应用包中monorepo-single-dependency-versions - 跨包使用单一版本fonts-config-plugin - 对自定义字体使用配置插件imports-design-system-folder - 组织设计系统导入js-hoist-intl - 提升 Intl 对象创建阅读单个规则文件以获取详细说明和代码示例:
rules/list-performance-virtualize.md
rules/animation-gpu-properties.md
每个规则文件包含:
完整指南(包含所有展开的规则):AGENTS.md