React Native Expo Vibe Coding: Routing and Permissions Configuration Template
A cross-platform app development template based on Expo Router and EAS, implementing type safety and automated native permissions configuration.

Completion Score
Overall completion rate is 83%. AI performs exceptionally well in generating route structures and type definitions, but may require manual intervention when handling complex native permission conflicts or specific device adaptations.
Dimension breakdown
File routing rules are clear; AI accurately generates dynamic routes and group structures, reducing manual configuration errors.
Automatically applies `userInterfaceStyle: automatic`, but SafeArea handling requires validation with `expo-secure-store` or specific UI libraries.
Permission declarations are centrally managed in the config, but runtime permission request logic requires additional code implementation; AI often misses dynamic checks.
EAS configuration is highly standardized, but signing certificate management across different platforms still requires manual intervention to ensure security.
Human checkpoint
Developers must manually review the permission description strings in `app.config.ts` to ensure compliance with App Store/Google Play review policies, and confirm that the EAS projectId configuration is correct.
Upgrade / downgrade path
If budget constraints exist, you can downgrade to local builds or use Expo Go for development. For more advanced CI/CD needs, integrate GitHub Actions to trigger EAS Build.
When to use & prerequisites
Suitable for developers looking to quickly scaffold cross-platform mobile applications, requiring a Node.js environment and Expo CLI. Ideal scenarios include team projects that need frequent UI iteration, handle native permissions (such as camera access), and rely on CI/CD automated builds.
Ready-to-copy configs
定义 Cursor AI 在 Expo Router 文件路由开发中的核心规则,确保类型安全与目录结构规范。
---
description: Expo Router file-based routing rules for React Native
alwaysApply: true
---
# Expo Router Rules
1. Use `app/` directory for all routes. Do not use manual navigation stacks.
2. Dynamic routes must be named `[slug].tsx` or `(group)/[id].tsx`.
3. Always import `expo-router` components (`Stack`, `Tabs`, `Link`) instead of `react-navigation` directly.
4. Ensure TypeScript strict mode is enabled in `tsconfig.json`.
5. Handle deep linking via `scheme` in `app.config.ts` and use `useRouter()` for programmatic navigation.
6. Group routes using parentheses `(group)` to hide them from URL structure but keep them in the stack.配置 Expo 应用元数据、原生权限声明及 EAS 构建环境变量,确保 iOS/Android 适配与商店审核合规。
import { ExpoConfig, ConfigContext } from 'expo/config';
export default ({ config }: ConfigContext): ExpoConfig => ({
...config,
name: "VibeApp",
slug: "vibe-app",
scheme: "vibeapp",
version: "1.0.0",
orientation: "portrait",
icon: "./assets/icon.png",
userInterfaceStyle: "automatic",
splash: {
image: "./assets/splash.png",
resizeMode: "contain",
backgroundColor: "#ffffff"
},
assetBundlePrefix: "vibeapp",
plugins: [
["expo-camera", { cameraPermission: "用于拍摄内容" }],
["expo-notifications", { androidMode: "transparent" }]
],
extra: {
eas: {
projectId: "YOUR_PROJECT_ID"
}
},
ios: {
bundleIdentifier: "com.example.vibeapp",
supportsTablet: true,
infoPlist: {
NSCameraUsageDescription: "需要访问相机以拍摄照片",
NSPhotoLibraryUsageDescription: "需要访问相册以选择图片"
}
},
android: {
package: "com.example.vibeapp",
permissions: ["CAMERA", "NOTIFICATIONS"]
}
});AI Vibe Coding in 4 steps
- 1
Initialize Expo Router Project Structure
Goal: Create a directory skeleton compliant with file-based routing standards, ensuring TypeScript type safety.
PromptCreate a new Expo project with Expo Router. Ensure `app/` directory exists. Add a `(tabs)` group with `home.tsx` and `settings.tsx`. Use strict TypeScript types for route params.Verify:
Run `npx expo start` and verify that the router generates correct links in `expo-router` dev tools. - 2
Configure Native Permissions and Theme
Goal: Declare camera permissions in `app.config.ts` and enable automatic light/dark mode.
PromptUpdate app.config.ts to include `expo-camera` plugin with permission string. Set `userInterfaceStyle` to 'automatic'. Ensure iOS Info.plist keys are generated correctly.Verify:
Run `npx expo prebuild` and check `ios/Info.plist` for NSCameraUsageDescription. - 3
Implement Safe Area and Gesture Navigation
Goal: Add SafeAreaProvider and Gesture Handler to ensure UI displays correctly on devices with notches.
PromptAdd `expo-secure-store` and `react-native-gesture-handler`. Wrap the root layout in `SafeAreaProvider`. Implement a simple swipe gesture on the home screen.Verify:
Run the app on a simulator with notch and verify content does not overlap system bars. - 4
Configure EAS Build and Review
Goal: Set up EAS projectId and generate build configuration files to prepare for cloud builds.
PromptInitialize EAS project. Create `eas.json` with development, preview, and production profiles. Ensure `app.config.ts` extra.eas.projectId is set.Verify:
Run `npx eas build --profile development --platform ios` (dry run) to check config validity.
Pitfalls & fixes
- Expo Router dynamic route naming errors causing type inference failures: ensure using `[slug].tsx` instead of `slug.tsx`.
- Native permissions behave inconsistently between development and production modes: explicitly handle runtime requests for `expo-permissions` or `expo-camera` in code.
- EAS build cache causing old configurations to persist: after modifying `app.config.ts`, execute `npx expo prebuild --clean` to regenerate native projects.
FAQ
How does Expo Router handle nested routes?
Use parentheses `(group)` to create logical groups; these directories do not appear in the URL but remain in the navigation stack. Dynamic parameters are defined via `[param].tsx`.
Why are permission descriptions in `app.config.ts` ineffective on iOS?
iOS permission descriptions must be written into Info.plist. Expo automatically generates them from the config, but you need to run `expo prebuild` or reinstall the app to refresh the native layer configuration.
How to debug when EAS Build fails?
Check profile settings in `eas.json` and projectId in `app.config.ts`. Review EAS console logs; errors typically stem from missing signing certificates or dependency version conflicts.


