All skills
vercel-labs avatar

/react-native-skills

@757ccb4 official
by Vercel Labsvercel-labs/agent-skills32k stars
2,784

React Native and Expo best practices for building performant mobile apps. Use when building React Native components, optimizing list performance, implementing animations, or working with native modules. Triggers on tasks involving React Native, Expo, mobile performance, or native platform APIs.

  • 42 files
  • 155.3 KB
  • MIT
  • Updated 8 months ago
  • GitHub

Use this Skill: https://skilld.dev/gh/vercel-labs/agent-skills/react-native-skills

This session only. Nothing lands on disk.

ruleslist-performance-item-expensive.md

≈617 tokens on demand. Your agent reads this file only when SKILL.md points to it.

Keep List Items Lightweight

List items should be as inexpensive as possible to render. Minimize hooks, avoid queries, and limit React Context access. Virtualized lists render many items during scroll—expensive items cause jank.

Incorrect (heavy list item):

function ProductRow({ id }: { id: string }) {
  // Bad: query inside list item
  const { data: product } = useQuery(['product', id], () => fetchProduct(id))
  // Bad: multiple context accesses
  const theme = useContext(ThemeContext)
  const user = useContext(UserContext)
  const cart = useContext(CartContext)
  // Bad: expensive computation
  const recommendations = useMemo(
    () => computeRecommendations(product),
    [product]
  )

  return <View>{/* ... */}</View>
}

Correct (lightweight list item):

function ProductRow({ name, price, imageUrl }: Props) {
  // Good: receives only primitives, minimal hooks
  return (
    <View>
      <Image source={{ uri: imageUrl }} />
      <Text>{name}</Text>
      <Text>{price}</Text>
    </View>
  )
}

Move data fetching to parent:

// Parent fetches all data once
function ProductList() {
  const { data: products } = useQuery(['products'], fetchProducts)

  return (
    <LegendList
      data={products}
      renderItem={({ item }) => (
        <ProductRow name={item.name} price={item.price} imageUrl={item.image} />
      )}
    />
  )
}

For shared values, use Zustand selectors instead of Context:

// Incorrect: Context causes re-render when any cart value changes
function ProductRow({ id, name }: Props) {
  const { items } = useContext(CartContext)
  const inCart = items.includes(id)
  // ...
}

// Correct: Zustand selector only re-renders when this specific value changes
function ProductRow({ id, name }: Props) {
  // use Set.has (created once at the root) instead of Array.includes()
  const inCart = useCartStore((s) => s.items.has(id))
  // ...
}

Guidelines for list items:

  • No queries or data fetching
  • No expensive computations (move to parent or memoize at parent level)
  • Prefer Zustand selectors over React Context
  • Minimize useState/useEffect hooks
  • Pass pre-computed values as props

The goal: list items should be simple rendering functions that take props and return JSX.

Source: SKILL.md on GitHub

No third-party reports yet.

Signed by skilld at 757ccb4. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub last month.

Steadyupdated 8 months ago
metadata
{
  "author": "vercel",
  "version": "1.0.0"
}
  • Performance
  • react-native
  • expo
  • animations
  • list-virtualization
  • mobile
  • reanimated
  • native-modules
  • ui-patterns
  • monorepo

README badge

README badge for vercel-labs/agent-skills/react-native-skills

Provides React Native and Expo best practices organized by performance impact, covering list virtualization, animations with Reanimated, navigation patterns, and native module configuration. Use when optimizing list rendering, implementing GPU-accelerated animations, or structuring React Native projects with native dependencies.

Generated from the current SKILL.md.

Does this skill cover both React Native and Expo?
Yes. The skill provides best practices for React Native and Expo applications, including Expo-specific patterns like expo-image and config plugins.
What animation library does this skill assume?
The skill focuses on React Native Reanimated for animations, with rules like using useDerivedValue and animating only transform and opacity properties.
Does this cover list performance optimization?
Yes. List performance is the highest priority category, covering FlashList virtualization, memoization, callback stabilization, and image optimization in lists.
Will this skill help with monorepo setup?
Yes, but only for monorepos with native dependencies. The skill includes guidance on structuring packages and managing dependency versions across a monorepo.
Does this cover state management frameworks like Redux or Zustand?
No. The skill covers only general state subscription patterns and dispatcher patterns, not specific state management libraries.

Generated from the current SKILL.md. These answers refresh after source changes.