移动端反应原生

其他 社区

技能解读

当前原文的自动摘译,尚未人工审校。

关键模式

一个组件 = 最多 150 行。如果超出则拆分首先使用 RN 核心组件(View、Text、Pressable、FlatList) Props:使用 TypeScript 接口定义 State:首先使用 useState,Zustand 如果复杂的 HTTP 请求:仅使用内置的 fetch。不要安装 Axios

建筑屏幕

创建app/{path}.tsx 按顺序构建:布局 -> 组件 -> 数据连接 处理空、加载、错误状态 在 Expo Go 上测试(手机扫描二维码) ESLint pass

流狐档案 运行与权限由流狐静态检查推断,不代表作者声明或实际测试结果。
领域
通用
作者声明的智能体
未找到明确声明;不据此推断已兼容或已测试
静态检查
88 / 100 · 启发式扫描,不代表运行安全
运行环境证据
未执行;当前没有隔离运行测试证据
作者 / 版本 / 许可证
@tomevault-io · 未声明许可证
上下文用量评级
低消耗
接入复杂程度
即装即用
是否需要外部接口密钥
不需要
兼容的系统
macOS · Linux · Windows
运行环境要求
未检出明确要求
检测到的文件与系统行为
  • 只读
  • 允许写入 / 修改
网络行为
允许外网请求
安装命令数
无(仅作为资料)

需要注意: 未声明工具权限范围;实际权限由运行环境决定。

作者说明文件(原文) SKILL.md

# Mobile — React Native + Expo

> **Mobile app only.** Do not apply to web-only projects.
> Verify stack matches `PROJECT_RULES.md`. Record architecture decisions in `docs/ai-dev/`.

## Initial Setup

```bash
npx create-expo-app@latest my-app --template blank-typescript
cd my-app
npx expo install expo-router expo-linking expo-constants
npx expo install nativewind tailwindcss
```

## Directory Structure

```
app/
├── _layout.tsx           # Root layout (navigation)
├── index.tsx             # Home screen
├── (tabs)/
│   ├── _layout.tsx       # Tab navigator
│   ├── home.tsx
│   └── profile.tsx
├── (auth)/
│   ├── login.tsx
│   └── signup.tsx
└── [id].tsx              # Dynamic route
components/
├── ui/                   # Reusable UI components
└── {feature}/            # Feature-specific components
lib/
├── api.ts                # API client (fetch)
└── storage.ts            # AsyncStorage helpers
types/
└── index.ts              # Shared types
```

## Key Patterns

- One component = max 150 lines. Split if exceeded
- Use RN core components first (`View`, `Text`, `Pressable`, `FlatList`)
- Props: define with TypeScript interfaces
- State: useState first, Zustand if complex
- **HTTP requests: use built-in `fetch` only. Do NOT install Axios**
- Navigation: Expo Router (file-based, like Next.js App Router)

## NativeWind Patterns

```tsx
// Layout
<View className="flex-1 px-4">
  <Text className="text-2xl font-bold text-gray-900 dark:text-white">Title</Text>
</View>

// Card
<View className="bg-white dark:bg-gray-800 rounded-xl p-4 shadow-sm">
  <Text className="text-lg font-semibold">{title}</Text>
</View>

// List
<FlatList
  data={items}
  keyExtractor={(item) => item.id}
  renderItem={({ item }) => <ItemCard item={item} />}
  contentContainerClassName="gap-3 p-4"
/>
```

## Running

```bash
npx expo start
# Phone: install "Expo Go" app, scan QR code
# iOS simulator: press "i" | Android emulator: press "a"
```

## Building Screens

1. Create `app/{path}.tsx`
2. Build in order: layout -> components -> data connection
3. Handle empty, loading, error states
4. Test on Expo Go (scan QR with phone)
5. ESLint pass

---
> Source: [ccivlcid/VibeHarness](https://github.com/ccivlcid/VibeHarness) — distributed by [TomeVault](https://tomevault.io).
<!-- tomevault:4.0:skill_md:2026-05-22 -->

讨论

基于 GitHub Discussions。登录 GitHub 即可参与讨论、点赞、订阅更新。