Iván

React Native

开发编程v1.0.0
作者:Iván更新于 2026-05-11react-native@clawhub_ivangdavila/react-native
代码生成前端开发

据 AlphaMoat 统计,截至 2026-09,React Native 累计下载 4,544 次、获 4 个星标,在全部 5,078 个 AI 技能中排名第 2,110 位,在「开发编程」分类(577 个)中排名第 269 位。

累计安装
122
累计下载
4,544
星标
4
全站排名
#2,110
全站前 42% · 「开发编程」前 47%
平台累计安装累计下载星标评论
ClawHub ↗1224,5444-
SkillHub ↗1184,3014—

各平台的计数口径不同,统计时间不一致。

这个技能是做什么的

主文建议长列表使用虚拟化方案,保持稳定的列表键,并按需要组织状态与样式;也涉及 Expo 项目导航及平台差异。运行未固定版本的 npx 命令或清理构建文件前,应核对依赖版本、当前项目和目标目录。

资料发布于 2026-10-29

可以用来做什么

  • 检查 React Native 长列表的渲染方式
  • 规划组件状态、导航或样式结构
  • 审查项目清理命令和构建目录

什么时候用

  • 需要设计或审查 React Native 应用实现,并能先核对依赖版本与项目路径时

示例提示词

以下是根据技能文档生成的示例,不代表实际运行结果。

根据一个列表场景比较虚拟列表与一次性渲染的适用性,不运行命令。
运行清理命令前,列出要确认的项目路径、工作区状态和平台目录。

月度数据趋势

累计下载4,544
1,9903,3624,7332026-03 · 累计下载 2,1792026-05 · 累计下载 3,2402026-06 · 累计下载 3,4892026-07 · 累计下载 3,9452026-08 · 累计下载 4,3282026-09 · 累计下载 4,54426-0326-09
星标4
3452026-03 · 星标 42026-05 · 星标 42026-06 · 星标 42026-07 · 星标 42026-08 · 星标 42026-09 · 星标 426-0326-09

2026-09 起统计方法调整:同名技能按作者分别统计,并覆盖全部技能。图中虚线为调整前的月份,与之后的数据不直接比较,也不计算跨越调整的增长。

月份累计下载环比星标
2026-094,544—4
2026-084,328+9.7%4
2026-073,945+13.1%4
2026-063,489+7.7%4
2026-053,240—4
2026-032,179—4

SKILL.md 原文

以下是作者发布的原始文件,按纯文本显示,本站未做修改或审核;其中的链接不可点击,命令请核实后再运行。抓取于 2026-10-23。

4.7 KB · ClawHub v1.0.0
---
name: React Native
description: Build performant cross-platform mobile apps with React Native components, navigation, and native modules.
metadata: {"clawdbot":{"emoji":"📱","requires":{"anyBins":["npx","expo"]},"os":["linux","darwin","win32"]}}
---

# React Native Development Rules

## Component Performance
- `FlatList` for any list over 10 items — `ScrollView` with `map` loads everything in memory, FlatList virtualizes
展开全部(共 77 行)
- `keyExtractor` must return stable unique strings — using index causes bugs on reorder and deletion
- `React.memo` prevents re-renders when props unchanged — wrap pure display components
- `useCallback` for functions passed to child components — new function reference triggers child re-render
- Avoid inline styles in render — creates new object every render, extract to `StyleSheet.create`

## State Management
- `useState` is fine for component-local state — don't add Redux/Zustand for a toggle
- Lift state to lowest common ancestor only — higher causes unnecessary re-renders
- `useMemo` for expensive computations — but don't overuse, caching has overhead
- Context re-renders all consumers on any change — split contexts by update frequency
- Avoid storing derived data in state — compute during render from source state

## Navigation
- React Navigation is the standard — Expo Router for file-based routing in Expo projects
- Stack screens stay mounted by default — clean up subscriptions and timers in `useEffect` cleanup
- Pass serializable params only — functions and complex objects break deep linking and state persistence
- `useFocusEffect` for screen-specific side effects — runs on focus, not just mount
- `navigation.reset` for auth flows — clears back stack, prevents returning to login after sign-in

## Styling
- `StyleSheet.create` outside component body — creates styles once, not every render
- Flexbox defaults differ from web — `flexDirection: 'column'`, no `display: flex` needed
- Dimensions in density-independent pixels — don't use pixel values from design tools directly
- `Platform.select` for platform-specific styles — cleaner than conditionals in style objects
- No CSS inheritance — text styles don't cascade, each Text needs explicit styling

## Native Modules
- Expo modules cover most needs — avoid ejecting for common features like camera, location, notifications
- `expo-dev-client` enables native modules without full eject — best of both worlds
- React Native New Architecture (Fabric, TurboModules) is opt-in — check library compatibility before enabling
- Native crashes don't show in JS debugger — check Xcode/Android Studio logs

## Performance Debugging
- Hermes engine should be enabled — significantly faster startup and lower memory
- `InteractionManager.runAfterInteractions` defers heavy work — keeps animations smooth
- `useNativeDriver: true` for animations — runs on UI thread, not JS thread
- `console.log` in production kills performance — remove or use `__DEV__` guard
- Flipper for debugging — network, layout, performance profiling

## Images
- Use `resizeMode` appropriately — `cover` crops, `contain` letterboxes, `stretch` distorts
- Prefetch images for smooth UX: `Image.prefetch(url)` before displaying
- Local images need explicit dimensions — remote images can use aspect ratio if one dimension set
- SVGs via `react-native-svg` — better scaling than PNGs for icons
- Cache remote images with `react-native-fast-image` — default Image has no persistent cache

## Common Mistakes
- `async` in `useEffect` directly — must define async function inside, then call it
- Missing `key` warnings in lists — always use unique, stable keys
- Assuming web React patterns work — no DOM, no CSS, different event system
- Forgetting cleanup in `useEffect` — subscriptions, timers, listeners leak without cleanup return
- Testing only on one platform — iOS and Android differ in behavior, test both regularly

## Platform Differences
- Android needs explicit `overflow: 'hidden'` for border radius clipping — iOS clips by default
- Shadows: iOS uses `shadow*` props, Android uses `elevation`
- StatusBar behavior differs — test visibility and color on both platforms
- Back button is Android-only — handle with `BackHandler` or navigation listeners
- Push notifications setup differs significantly — platform-specific configuration required

## Build & Release
- `npx react-native clean` for unexplained build failures — clears caches and derived data
- iOS: `cd ios && pod install` after adding native dependencies — often forgotten step
- Android: `cd android && ./gradlew clean` for stubborn build issues
- EAS Build (Expo) simplifies CI/CD — handles signing, versioning, submission
- Test release builds locally before submitting — development and production behavior differ

「开发编程」分类下的热门技能

Iván 的其他技能

数据月份:2026-09 · 下载/星标/安装数聚合自公开技能注册库(ClawHub、SkillHub),按月更新。口径说明见数据方法。