← 返回 Skills 市场
ivangdavila

React Native

作者 Iván · GitHub ↗ · v1.0.0
linuxdarwinwin32 ✓ 安全检测通过
2322
总下载
4
收藏
10
当前安装
1
版本数
在 OpenClaw 中安装
/install react-native
功能描述
Build performant cross-platform mobile apps with React Native components, navigation, and native modules.
使用说明 (SKILL.md)

React Native Development Rules

Component Performance

  • FlatList for any list over 10 items — ScrollView with map loads everything in memory, FlatList virtualizes
  • 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
安全使用建议
This skill is a benign, read-only set of React Native development rules and does not request credentials or install code. Before installing, note that: (1) the skill expects npx or expo to be available — if the agent is permitted to run commands, it could execute those tools in your workspace, so ensure the agent's execution environment is restricted to projects you trust; (2) the skill source is unknown — prefer skills from known authors or repositories when possible; and (3) although the document mentions build steps that in practice may require platform signing keys (Apple/Google), this skill does not ask for them. If you allow autonomous agent actions, audit what commands the agent will actually run in your projects.
功能分析
Type: OpenClaw Skill Name: react-native Version: 1.0.0 The skill bundle contains metadata and a comprehensive set of React Native development best practices and guidelines in SKILL.md. There is no executable code beyond standard development tools mentioned (npx, expo), and no instructions for the AI agent that suggest data exfiltration, malicious execution, persistence, or prompt injection with harmful objectives. The content is purely informational and aligned with its stated purpose.
能力评估
Purpose & Capability
Name/description (React Native development guidance) match the requirements: the skill only requires developer tooling (npx or expo), which is appropriate for building or running RN commands. No unrelated binaries or credentials are requested.
Instruction Scope
SKILL.md is a developer best-practices document (performance, navigation, native modules, build steps). It does not instruct the agent to read unrelated system files or exfiltrate data. It mentions common build commands (pod install, ./gradlew clean, npx react-native clean) but only as standard developer steps; there are no open-ended instructions that grant broad discretionary access.
Install Mechanism
No install spec and no code files — instruction-only, so nothing is downloaded or written to disk by the skill itself. This is the lowest-risk install model.
Credentials
The skill declares no required environment variables or credentials. This is proportional: React Native guidance typically does not need secrets. (Note: actual mobile build processes sometimes require platform-specific credentials, but this skill does not request them.)
Persistence & Privilege
always is false and the skill does not request system-wide configuration or persistent privileges. Autonomous invocation is allowed by default (normal for skills) but the content itself does not ask to modify other skills or global settings.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install react-native
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /react-native 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.0
Initial release
元数据
Slug react-native
版本 1.0.0
许可证
累计安装 10
当前安装数 10
历史版本数 1
常见问题

React Native 是什么?

Build performant cross-platform mobile apps with React Native components, navigation, and native modules. 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 2322 次。

如何安装 React Native?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install react-native」即可一键安装,无需额外配置。

React Native 是免费的吗?

是的,React Native 完全免费(开源免费),可自由下载、安装和使用。

React Native 支持哪些平台?

React Native 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(linux, darwin, win32)。

谁开发了 React Native?

由 Iván(@ivangdavila)开发并维护,当前版本 v1.0.0。

💬 留言讨论