agentleFS
G1JoshiG1Joshi/Agent-Skills/skills/mobile/react-native/SKILL.md

react-native

Skill15 starsChanged 42 days agoMITView on GitHub

Expert React Native assistance covering the New Architecture (TurboModules, Fabric renderer, Bridgeless mode), Hermes JS engine, React Navigation, and native styling. Use when building cross-platform mobile apps for iOS and Android using React and TypeScript.

15 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use agent-teams, security and 1 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • travisjneumanSkill

    agent-teams

    Team composition knowledge for Claude Code Agent Teams - when teams fit, optimal sizing, spawn prompt patterns. Use only when the user has explicitly enabled agent teams for the session.

    Also in 3 projects that use this

  • 0xSeroSkill

    security

    Also in 4 projects that use this

  • CloudflareSkill

    security-audit

    Security guidance and vulnerability review for codebases, APIs, services, CLI tools, libraries, and daemons. Use for security questions, focused reviews, vulnerability research, security audits, or pen tests. Run the complete workflow only for explicit codebase audit or pen-test requests, full/comprehensive/end-to-end reviews, or requested report artifacts.

    Also in 3 projects that use this

The file

We split this skill into the rules it gives an agent

2 rules. 0 are common, 0 are distinctive, and 2 are very specific to this project.

  • 0

    Common

    Most of the 9 edited versions we read keep these.

  • 0

    Distinctive

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Solution: Run animations on UI thread using react-native-reanimated.

    line 140
  2. Very specific:

    Use FlashList Instead of FlatList: Adopt Shopify's @shopify/flash-list for recycling cell views without memory spikes or blank cells.

    line 186

“Common” is measured: kept by at least 6 in 10 of the 9 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

React Native

React Native allows you to build native mobile apps using React and JavaScript/TypeScript. It renders veritable native UI components (not webviews), offering performance close to native apps while maintaining the React developer experience.

When to Use

  • Universal Mobile Apps: Building cross-platform iOS and Android applications using React and TypeScript.
  • The New Architecture: Leveraging TurboModules, Fabric concurrent rendering, and Bridgeless mode for 60/120fps native performance.
  • Code Sharing Across Web & Mobile: Sharing hooks, validation logic, and state stores between React web apps and React Native mobile apps.
  • Ecosystem Scale: Accessing the massive ecosystem of React Native libraries, devtools, and component libraries.

Quick Start

Using Expo (Recommended production standard):

npx create-expo-app@latest my-app
cd my-app
npx expo start
// app/index.tsx (Expo Router)
import { useState } from "react";
import { View, Text, Button, StyleSheet } from "react-native";
import { Link } from "expo-router";

export default function Home() {
  const [count, setCount] = useState(0);

  return (
    <View style={styles.container}>
      <Text style={styles.text}>Count: {count}</Text>
      <Button title="Increment" onPress={() => setCount((c) => c + 1)} />

      <Link href="/details" style={styles.link}>
        Go to Details
      </Link>
    </View>
  );
}

const styles = StyleSheet.create({
  container: { flex: 1, justifyContent: "center", alignItems: "center" },
  text: { fontSize: 24, marginBottom: 20 },
  link: { marginTop: 20, color: "blue" },
});

Core Concepts

Fabric Renderer & TurboModules (New Architecture)

Replaces legacy JSON bridge serialization with direct C++ JSI (JavaScript Interface) calls for instant memory access and synchronous layout passes:

// Modern TurboModule invocation runs synchronously without serialization penalty
import { TurboModuleRegistry } from "react-native";

export interface Spec extends TurboModule {
  multiply(a: number, b: number): Promise<number>;
  syncCalculation(x: number): number; // Synchronous C++ method
}

export default TurboModuleRegistry.getEnforcing<Spec>("CustomMathModule");

High-Performance Layout with Flexbox (Yoga)

React Native uses Yoga C++ engine to implement CSS Flexbox layout calculations directly into native mobile views:

import { StyleSheet, View, Text } from "react-native";

export const ProfileHeader = () => (
  <View style={styles.container}>
    <View style={styles.avatarPlaceholder} />
    <View style={styles.textColumn}>
      <Text style={styles.name}>Jane Doe</Text>
      <Text style={styles.role}>Principal Engineer</Text>
    </View>
  </View>
);

const styles = StyleSheet.create({
  container: {
    flexDirection: "row",
    alignItems: "center",
    padding: 16,
    backgroundColor: "#ffffff",
  },
  avatarPlaceholder: {
    width: 48,
    height: 48,
    borderRadius: 24,
    backgroundColor: "#6366f1",
  },
  textColumn: { marginLeft: 12 },
  name: { fontSize: 16, fontWeight: "600", color: "#111827" },
  role: { fontSize: 13, color: "#6b7280" },
});

Concurrent Reanimated Animations

Executes fluid gestures and physics-based animations directly on the UI thread via worklets:

import Animated, {
  useSharedValue,
  useAnimatedStyle,
  withSpring,
} from "react-native-reanimated";

export const PulsingBadge = () => {
  const scale = useSharedValue(1);

  const animatedStyle = useAnimatedStyle(() => ({
    transform: [{ scale: scale.value }],
  }));

  const triggerPulse = () => {
    scale.value = withSpring(scale.value === 1 ? 1.2 : 1);
  };

  return <Animated.View style={[styles.badge, animatedStyle]} />;
};

Common Patterns

High-Performance Animations with Reanimated

Problem: JavaScript thread frame drops cause jittery mobile gesture animations.
Solution: Run animations on UI thread using react-native-reanimated.

import Animated, {
  useSharedValue,
  useAnimatedStyle,
  withSpring,
} from "react-native-reanimated";
import { GestureDetector, Gesture } from "react-native-gesture-handler";

export function DraggableBox() {
  const offset = useSharedValue({ x: 0, y: 0 });

  const panGesture = Gesture.Pan()
    .onChange((e) => {
      offset.value = {
        x: offset.value.x + e.changeX,
        y: offset.value.y + e.changeY,
      };
    })
    .onEnd(() => {
      offset.value = withSpring({ x: 0, y: 0 });
    });

  const animatedStyle = useAnimatedStyle(() => ({
    transform: [{ translateX: offset.value.x }, { translateY: offset.value.y }],
  }));

  return (
    <GestureDetector gesture={panGesture}>
      <Animated.View
        style={[
          { width: 80, height: 80, backgroundColor: "#6366f1" },
          animatedStyle,
        ]}
      />
    </GestureDetector>
  );
}

Best Practices

Do:

  • Enable the New Architecture: Ensure newArchEnabled=true is active in android/gradle.properties and CocoaPods.
  • Use FlashList Instead of FlatList: Adopt Shopify's @shopify/flash-list for recycling cell views without memory spikes or blank cells.
  • Extract Styles with StyleSheet.create: Prevent creating new style objects on every render pass.
  • Profile with React DevTools and Flipper/Chrome Inspector: Measure layout passes and identify unnecessary component re-renders.

Don't:

  • Pass raw anonymous functions to FlatList items: Memoize render items using useCallback or dedicated subcomponents.
  • Perform heavy work on the JavaScript thread: Offload encryption, image compression, and heavy parsing to background threads or native modules.
  • Ignore Android BackHandler: Always handle hardware back presses to avoid terminating user flows abruptly.

Troubleshooting

ErrorCauseSolution
Metro Bundler process exited with code 1Port in use or bad cache.npx expo start -c (clear cache).
Invariant Violation: View config not foundImport issues or upgrading RN versions.Check node_modules, clear watchman.
CocoaPods could not find compatible versionsiOS dependency conflict.cd ios && pod install --repo-update.
Text strings must be rendered within a <Text> componentRaw text directly inside View.Wrap all strings in <Text>.

References

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

Reviews can't be read right now.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.