AGENT SKILL

react-native-expert

Builds, optimizes, and debugs cross-platform mobile applications with React Native and Expo. Implements navigation hierarchies (tabs, stacks, drawers), configures native modules, optimizes FlatList rendering with memo and useCallback, and handles platform-specific code for iOS and Android. Use when building a React Native or Expo mobile app, setting up navigation, integrating native modules, improving scroll performance, handling SafeArea or keyboard input, or configuring Expo SDK projects.

适用职业开发工程师
使用场景前端开发
License 许可
MIT
最近更新
2026-06-29
Stars
★ 0
Forks
0

01 前言 Front Matter

name
react-native-expert
license
MIT
metadata
{ "role": "specialist", "scope": "implementation", "author": "https://github.com/Jeffallan", "domain": "frontend", "version": "1.1.0", "triggers": "React Native, Expo, mobile app, iOS, Android, cross-platform, native module", "output-format": "code", "related-skills": "react-expert, flutter-expert, test-master" }
description
Builds, optimizes, and debugs cross-platform mobile applications with React Native and Expo. Implements navigation hierarchies (tabs, stacks, drawers), configures native modules, optimizes FlatList rendering with memo and useCallback, and handles platform-specific code for iOS and Android. Use when building a React Native or Expo mobile app, setting up navigation, integrating native modules, improving scroll performance, handling SafeArea or keyboard input, or configuring Expo SDK projects.

02 资源文件 75

03 SKILL.md 正文

React Native Expert

Senior mobile engineer building production-ready cross-platform applications with React Native and Expo.

Core Workflow

  1. Setup — Expo Router or React Navigation, TypeScript config → run npx expo doctor to verify environment and SDK compatibility; fix any reported issues before proceeding
  2. Structure — Feature-based organization
  3. Implement — Components with platform handling → verify on iOS simulator and Android emulator; check Metro bundler output for errors before moving on
  4. Optimize — FlatList, images, memory → profile with Flipper or React DevTools
  5. Test — Both platforms, real devices

Error Recovery

  • Metro bundler errors → clear cache with npx expo start --clear, then restart
  • iOS build fails → check Xcode logs → resolve native dependency or provisioning issue → rebuild with npx expo run:ios
  • Android build fails → check adb logcat or Gradle output → resolve SDK/NDK version mismatch → rebuild with npx expo run:android
  • Native module not found → run npx expo install <module> to ensure compatible version, then rebuild native layers

Reference Guide

Load detailed guidance based on context:

Topic Reference Load When
Navigation references/expo-router.md Expo Router, tabs, stacks, deep linking
Platform references/platform-handling.md iOS/Android code, SafeArea, keyboard
Lists references/list-optimization.md FlatList, performance, memo
Storage references/storage-hooks.md AsyncStorage, MMKV, persistence
Structure references/project-structure.md Project setup, architecture

Constraints

MUST DO

  • Use FlatList/SectionList for lists (not ScrollView)
  • Implement memo + useCallback for list items
  • Handle SafeAreaView for notches
  • Test on both iOS and Android real devices
  • Use KeyboardAvoidingView for forms
  • Handle Android back button in navigation

MUST NOT DO

  • Use ScrollView for large lists
  • Use inline styles extensively (creates new objects)
  • Hardcode dimensions (use Dimensions API or flex)
  • Ignore memory leaks from subscriptions
  • Skip platform-specific testing
  • Use waitFor/setTimeout for animations (use Reanimated)

Code Examples

Optimized FlatList with memo + useCallback

import React, { memo, useCallback } from 'react';
import { FlatList, View, Text, StyleSheet } from 'react-native';

type Item = { id: string; title: string };

const ListItem = memo(({ title, onPress }: { title: string; onPress: () => void }) => (
  <View style={styles.item}>
    <Text onPress={onPress}>{title}</Text>
  </View>
));

export function ItemList({ data }: { data: Item[] }) {
  const handlePress = useCallback((id: string) => {
    console.log('pressed', id);
  }, []);

  const renderItem = useCallback(
    ({ item }: { item: Item }) => (
      <ListItem title={item.title} onPress={() => handlePress(item.id)} />
    ),
    [handlePress]
  );

  return (
    <FlatList
      data={data}
      keyExtractor={(item) => item.id}
      renderItem={renderItem}
      removeClippedSubviews
      maxToRenderPerBatch={10}
      windowSize={5}
    />
  );
}

const styles = StyleSheet.create({
  item: { padding: 16, borderBottomWidth: StyleSheet.hairlineWidth },
});

KeyboardAvoidingView Form

import React from 'react';
import {
  KeyboardAvoidingView,
  Platform,
  ScrollView,
  TextInput,
  StyleSheet,
  SafeAreaView,
} from 'react-native';

export function LoginForm() {
  return (
    <SafeAreaView style={styles.safe}>
      <KeyboardAvoidingView
        style={styles.flex}
        behavior={Platform.OS === 'ios' ? 'padding' : 'height'}
      >
        <ScrollView contentContainerStyle={styles.content} keyboardShouldPersistTaps="handled">
          <TextInput style={styles.input} placeholder="Email" autoCapitalize="none" />
          <TextInput style={styles.input} placeholder="Password" secureTextEntry />
        </ScrollView>
      </KeyboardAvoidingView>
    </SafeAreaView>
  );
}

const styles = StyleSheet.create({
  safe: { flex: 1 },
  flex: { flex: 1 },
  content: { padding: 16, gap: 12 },
  input: { borderWidth: 1, borderRadius: 8, padding: 12, fontSize: 16 },
});

Platform-Specific Component

import { Platform, StyleSheet, View, Text } from 'react-native';

export function StatusChip({ label }: { label: string }) {
  return (
    <View style={styles.chip}>
      <Text style={styles.label}>{label}</Text>
    </View>
  );
}

const styles = StyleSheet.create({
  chip: {
    paddingHorizontal: 12,
    paddingVertical: 4,
    borderRadius: 999,
    backgroundColor: '#0a7ea4',
    // Platform-specific shadow
    ...Platform.select({
      ios: { shadowColor: '#000', shadowOffset: { width: 0, height: 2 }, shadowOpacity: 0.2, shadowRadius: 4 },
      android: { elevation: 3 },
    }),
  },
  label: { color: '#fff', fontSize: 13, fontWeight: '600' },
});

Output Format

When implementing React Native features, deliver:

  1. Component code — TypeScript, with prop types defined
  2. Platform handling — Platform.select or .ios.tsx / .android.tsx splits as needed
  3. Navigation integration — route params typed, back-button handling included
  4. Performance notes — memo boundaries, key extractor strategy, image caching

Knowledge Reference

React Native 0.73+, Expo SDK 50+, Expo Router, React Navigation 7, Reanimated 3, Gesture Handler, AsyncStorage, MMKV, React Query, Zustand

04 同仓库更多 Skills

Blake-John
Blake-John/agent-config

websocket-engineer

当使用 WebSocket 或 Socket.IO 构建实时通信系统时使用。适用于双向消息通信、Redis 水平扩展、在线状态追踪、房间管理。

★ 0
Blake-John
Blake-John/agent-config

security-reviewer

识别安全漏洞,生成带有严重性评级的结构化审计报告,并提供可操作的安全修复建议。在开展安全审计、审查代码漏洞或分析基础设施安全时使用。适用于 SAST 扫描、渗透测试、DevSecOps 实践、云安全审查、依赖审计、密钥扫描或合规检查。生成漏洞报告、优先级建议和合规清单。

开发工程师测试与质量Skill与智能体开发
★ 0
Blake-John
Blake-John/agent-config

secure-code-guardian

用于实现认证/授权、保护用户输入或防御 OWASP Top 10 漏洞 —— 包括自定义安全实现,例如使用 bcrypt/argon2 哈希密码、使用参数化语句清理 SQL 查询、配置 CORS/CSP 头部、使用 Zod 验证输入以及设置 JWT token。适用于认证、授权、输入验证、加密、OWASP Top 10 防护、安全会话管理和安全加固。对于预构建的 OAuth/SSO 集成或独立的安全审计,请考虑使用更专业的 skill。

开发工程师
★ 0
Blake-John
Blake-John/agent-config

rust-engineer

编写、审查和调试符合 Rust 风格的代码,确保内存安全和零成本抽象。实现所有权模式、管理生命周期、设计 trait 层级、使用 tokio 构建异步应用程序,以及使用 Result/Option 结构化错误处理。适用于构建 Rust 应用程序、解决所有权或借用问题、设计基于 trait 的 API、实现 async/await 并发、创建 FFI 绑定,或优化性能和内存安全。触发词:Rust, Cargo, ownership, borrowing, lifetimes, async Rust, tokio, zero-cost abstractions, memory safety, systems programming。

开发工程师
★ 0
Blake-John
Blake-John/agent-config

react-native-expert

使用 React Native 和 Expo 构建、优化和调试跨平台移动应用。实现导航层级结构(标签页、堆栈、抽屉),配置原生模块,使用 memo 和 useCallback 优化 FlatList 渲染,处理 iOS 和 Android 的平台特定代码。在构建 React Native 或 Expo 移动应用、设置导航、集成原生模块、改善滚动性能、处理 SafeArea 或键盘输入、配置 Expo SDK 项目时使用。

前端开发
★ 0
Blake-John
Blake-John/agent-config

react-expert

当你使用 .jsx 或 .tsx 文件构建 React 18+ 应用、Next.js App Router 项目或 create-react-app 时使用。创建组件、实现自定义 hooks、调试渲染问题、将类组件迁移为函数组件、以及实现状态管理。适用于 Server Components、Suspense 边界、useActionState 表单、性能优化或 React 19 特性。

前端开发
★ 0