React Native Cursor Rules

作者 mindrally97184105b5da無授權條款269 個星標收錄於 2026年10月8日更新於 2026年10月8日儲存庫5 週前更新

React Native development best practices for TypeScript, functional components, performance optimization, and styling guidelines.

AI 產生的概覽

提供 React Native 編碼規範,涵蓋 TypeScript 風格、元件結構、效能最佳化與樣式指南。

功能
此技能為 AI 代理提供一套 React Native 開發慣例,用於撰寫或審查行動應用程式程式碼。內容涵蓋程式碼風格與檔案組織、命名慣例、嚴格的 TypeScript 用法、hooks 與 FlatList 的效能最佳化,以及 UI 樣式實務。它產出的是指引與慣例,而非可執行的成品。
適用情境
適用於以 TypeScript 撰寫、重構或審查 React Native 程式碼時,尤其是在需要統一元件結構、命名與效能模式的情況下。也可作為為 React Native 專案制定慣例的參考。
執行需求
不需要任何工具、套件或憑證;僅為說明性指示,不含指令碼。

React Native Cursor Rules

Expert guidelines for React Native development by Will Sims, focusing on type-safe TypeScript code, performance optimization, and maintainable component architecture.

Code Style and Structure

  • Write concise, type-safe TypeScript code
  • Use functional components and hooks instead of class components
  • Ensure components are modular, reusable, and maintainable
  • Organize files by feature, grouping related components, hooks, and styles

Naming Conventions

  • Use camelCase for variables and functions (e.g., isFetchingData, handleUserInput)
  • Use PascalCase for components (e.g., UserProfile, ChatScreen)
  • Directory names should be lowercase and hyphenated (e.g., user-profile, chat-screen)

TypeScript Usage

  • Use TypeScript for all components, favoring interfaces for props and state
  • Enable strict typing in tsconfig.json
  • Avoid any type; strive for precise types
  • Utilize React.FC for defining functional components with props

Performance Optimization

  • Minimize useEffect, useState, and heavy computations in render methods
  • Use React.memo() for components with static props to prevent unnecessary re-renders
  • Optimize FlatLists with the following props:
    • removeClippedSubviews
    • maxToRenderPerBatch
    • windowSize
  • Use getItemLayout for consistent-sized FlatList items
  • Avoid anonymous functions in renderItem or event handlers

UI and Styling

  • Use consistent styling via StyleSheet.create() or Styled Components
  • Ensure responsive design for different screen sizes and orientations
  • Optimize images using react-native-fast-image

Best Practices

  • Follow React Native's threading model for smooth performance
  • Utilize Expo's EAS Build and Over-The-Air updates
  • Use React Navigation for navigation and deep linking

來源與署名

來源:mindrally/skills位於react-native-cursor-rules提交9718410

授權條款: 無授權條款

內容歸原作者所有。SourceWeft 從公開儲存庫中收錄這些內容。

檢舉或申請下架