Installable skillMIT

React Native Development Rules

Build performant cross-platform mobile apps with React Native components, navigation, and native modules.

BY clawicUPDATED Oct 30, 2026
INTENDED FORβ—ˆOpenClawInstall in a listed agent.

instructions.md

---
name: react-native-ef6b823bbb40
slug: react-native
version: 1.0.0
description: Build performant cross-platform mobile apps with React Native components, navigation, and native modules.
homepage: https://clawic.com/skills/react-native
metadata:
  clawdbot:
    emoji: πŸ“±
    requires:
      anyBins:
      - npx
      - expo
    os:
    - linux
    - darwin
    - win32
    displayName: React Native
---

# React Native Development Rules

## Component Performance
- `FlatList` for any list over 10 items β€” `ScrollView` with `map` loads everything in memory, FlatList virtualizes
- `keyExtractor` must return stable unique strings β€” using index causes bugs on reorder and deletion
- `React.memo` prevents re-renders when props unchanged β€” wrap pure display components
- `useCallback` for functions passed to child components β€” new function reference triggers child re-render
- Avoid inline styles in render β€” creates new object every render, extract to `StyleSheet.create`

## State Management
- `useState` is fine for component-local state β€” don't add Redux/Zustand for a toggle
- Lift state to lowest common ancestor only β€” higher causes unnecessary re-renders
- `useMemo` for expensive computations β€” but don't overuse, caching has overhead
- Context re-renders all consumers on any change β€” split contexts by update frequency
- Avoid storing derived data in state β€” compute during render from source state

## Navigation
- React Navigation is the standard β€” Expo Router for file-based routing in Expo projects
- Stack screens stay mounted by default β€” clean up subscriptions and timers in `useEffect` cleanup
- Pass serializable params only β€” functions and complex objects break deep linking and state persistence
- `useFocusEffect` for screen-specific side effects β€” runs on focus, not just mount
- `navigation.reset` for auth flows β€” clears back stack, prevents returning to login after sign-in

## Styling
- `StyleSheet.create` outside component body β€” creates styles once, not every render
- Flexbox defaults differ from web β€” `flexDirection: 'column'`, no `display: flex` needed
- Dimensions in density-independent pixels β€” don't use pixel values from design tools directly
- `Platform.select` for platform-specific styles β€” cleaner than conditionals in style objects
- No CSS inheritance β€” text styles don't cascade, each Text needs explicit styling

## Native Modules
- Expo modules cover most needs β€” avoid ejecting for common features like camera, location, notifications
- `expo-dev-client` enables native modules without full eject β€” best of both worlds
- React Native New Architecture (Fabric, TurboModules) is opt-in β€” check library compatibility before enabling
- Native crashes don't show in JS debugger β€” check Xcode/Android Studio logs

## Performance Debugging
- Hermes engine should be enabled β€” significantly faster startup and lower memory
- `InteractionManager.runAfterInteractions` defers heavy work β€” keeps animations smooth
- `useNativeDriver: true` for animations β€” runs on UI thread, not JS thread
- `console.log` in production kills performance β€” remove or use `__DEV__` guard
- Flipper for debugging β€” network, layout, performance profiling

## Images
- Use `resizeMode` appropriately β€” `cover` crops, `contain` letterboxes, `stretch` distorts
- Prefetch images for smooth UX: `Image.prefetch(url)` before displaying
- Local images need explicit dimensions β€” remote images can use aspect ratio if one dimension set
- SVGs via `react-native-svg` β€” better scaling than PNGs for icons
- Cache remote images with `react-native-fast-image` β€” default Image has no persistent cache

## Common Mistakes
- `async` in `useEffect` directly β€” must define async function inside, then call it
- Missing `key` warnings in lists β€” always use unique, stable keys
- Assuming web React patterns work β€” no DOM, no CSS, different event system
- Forgetting cleanup in `useEffect` β€” subscriptions, timers, listeners leak without cleanup return
- Testing only on one platform β€” iOS and Android differ in behavior, test both regularly

## Platform Differences
- Android needs explicit `overflow: 'hidden'` for border radius clipping β€” iOS clips by default
- Shadows: iOS uses `shadow*` props, Android uses `elevation`
- StatusBar behavior differs β€” test visibility and color on both platforms
- Back button is Android-only β€” handle with `BackHandler` or navigation listeners
- Push notifications setup differs significantly β€” platform-specific configuration required

## Build & Release
- `npx react-native clean` for unexplained build failures β€” clears caches and derived data
- iOS: `cd ios && pod install` after adding native dependencies β€” often forgotten step
- Android: `cd android && ./gradlew clean` for stubborn build issues
- EAS Build (Expo) simplifies CI/CD β€” handles signing, versioning, submission
- Test release builds locally before submitting β€” development and production behavior differ
COMPATIBILITY & REFERENCES

Platform guidance

Imported from the listed AgentSkill.sh category. Complete supplied package files and notices are retained. Required external tools and credentials are not installed. No bundled code was executed during import. Individual agent task behavior has not been tested.