react-native

A set of coding rules for building mobile apps with React Native, a framework for making iOS and Android apps with JavaScript or TypeScript. It covers components, styling, navigation, and platform-specific code.

In plain words
What is it for?
It is for creating and maintaining React Native screens, reusable components, styles, navigation flows, hooks, and iOS- or Android-specific behavior.
Why use it?
It gives the coding agent consistent patterns for layouts, text, navigation, and device differences. This helps prevent common mobile errors, such as displaying text outside the required text component.

Cursor rule

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add rules/nedcodes-ok/cursor-doctor/react-native
Clone the repo
git clone --depth 1 https://github.com/nedcodes-ok/cursor-doctor
Per session 665 This file is loaded in full into every session.
When invoked 665 The same file — it is already loaded in full.
Security scan A 0 findings. Scan, not verified.
Origin 100% copy Near-identical to another mod in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00665 $0.00665
Opus 5 $0.00332 $0.00332
Sonnet 5 $0.00133 $0.00133
Haiku 4.5 $0.00067 $0.00067

Measured yesterday against content hash 2125708da5f6, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

react-native scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured yesterday.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

Origin

This is a copy

100% identical to react-native — 0 lines differ, which has more behind it and is treated as the original. This page carries a canonical link to it rather than competing with it.

pro-kit/templates/frameworks/react-native.mdc · 61 lines

How it starts

The opening of the file, as written. The whole thing — 61 lines — stays where its author put it; the contents beside it link to each section on GitHub.

React Native Cursor Rules

You are an expert React Native developer. Follow these rules:

Components

  • Functional components only with TypeScript
  • Use View, Text, Pressable from react-native, not HTML elements
  • Never use TouchableOpacity or TouchableHighlight, use Pressable instead
  • Wrap all visible text in <Text> components, bare strings crash on Android
  • Platform-specific files: Component.ios.tsx / Component.android.tsx when needed
  • Keep components under 150 lines, extract custom hooks for logic

Styling

  • Use StyleSheet.create() for all styles, not inline objects
  • Never use percentage-based dimensions for critical layouts, use Dimensions or useWindowDimensions
  • Use flex for layouts, not absolute positioning unless truly necessary
  • Platform-specific styles via Platform.select() or Platform.OS checks
  • Avoid magic numbers, define spacing/sizing constants
  • Use gap property for spacing between flex children (RN 0.71+)
  • React Navigation is the standard. Use typed navigation with NativeStackNavigationProp
  • Define a root param list type and use it everywhere
  • Use useNavigation and useRoute hooks, not prop drilling
  • Deep linking: define linking config at the navigator level
  • Keep screen components thin, extract business logic into hooks

Performance

  • Use FlatList for lists, never ScrollView with .map() for dynamic data
  • Always provide keyExtractor returning a stable string ID
  • Memoize list items with React.memo and extract renderItem outside the component
  • Use useCallback for event handlers passed to list items
  • Avoid anonymous functions in renderItem
  • Images: use FastImage (or expo-image) for caching, specify dimensions
  • Minimize bridge crossings: batch state updates, avoid rapid setState in loops

State and Data

  • Use React Query / TanStack Query for server state
  • Zustand or Jotai for global client state, avoid Redux unless already in the project
  • AsyncStorage for small key-value persistence, MMKV for performance-critical storage
  • Never store sensitive data in AsyncStorage, use expo-secure-store or Keychain

Read the full file on GitHub · 61 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. yesterday First seen · 61 lines · 665 tokens per session scan A 2125708da5f6

Subscribe to this mod's changes

react-native is a cursor rule published in the GitHub repository nedcodes-ok/cursor-doctor (9 stars, last pushed 5mo ago), licensed MIT. It adds 665 tokens to every session, about $0.0033 per session on Opus 5. A static security scan graded it A with 0 findings. It is 100% identical to react-native, differing in 0 lines, and is treated as a copy.