NativeWind Setup in Expo

The config files NativeWind needs in an Expo project and how to check that classes are being applied.

NativeWind needs four small changes: Tailwind config, a CSS entry file, a Babel preset and a Metro wrapper. The files below match NativeWind v4; always compare with the current install page because versions track Tailwind.

Core concepts

  1. Install packages: Use npx expo install nativewind react-native-reanimated react-native-safe-area-context plus tailwindcss as a dev dependency. Reanimated powers some class-driven animations. — NativeWind docs
  2. tailwind.config.js: Point content at app/ and components/, and add the NativeWind preset so React Native utilities exist. — NativeWind docs
  3. global.css, Babel and Metro: Create a CSS file with the Tailwind directives, enable the NativeWind Babel preset, wrap the Metro config, and import the CSS file once in your root layout. — Expo Tailwind guide
  4. Verify it works: Add a class such as bg-red-500 to a view, reload with cache cleared (npx expo start -c), and confirm the colour appears. — Expo docs

Concept videos

YouTube channels and searches for these topics. On a large screen they open in the reading panel next to the roadmap.

Explanation

Clear the cache after config changes

Metro caches transformed files. After editing Tailwind, Babel or Metro config, restart with npx expo start -c before assuming something is broken.

Content paths matter

If a folder is missing from content, classes used only there are not generated and styles silently disappear.

What Is It?

The NativeWind setup connects Tailwind's class generation to React Native's style system through Babel and Metro.

Why Should I Care?

Most NativeWind problems are config problems, so a verified setup saves hours of misdiagnosed styling bugs.

Real World Analogy

It is wiring a new appliance: four connections, and nothing lights up until all four are plugged in.

Visual Mental Model

text
global.css -> Tailwind (config + content paths) -> Babel preset -> Metro wrapper -> styled components

Smallest Possible Example

js
/** @type {import('tailwindcss').Config} */
module.exports = {
  content: ['./app/**/*.{js,jsx,ts,tsx}', './components/**/*.{js,jsx,ts,tsx}'],
  presets: [require('nativewind/preset')],
  theme: { extend: {} },
  plugins: [],
};

Common Mistakes

❌ Forgetting to import global.css in the root layout.

No CSS is loaded, so no class has any effect.

❌ Not restarting Metro with a cleared cache.

Old transformed bundles hide the new config.

Build This Mini Project

Set up NativeWind in a fresh Expo project and render a coloured card to prove classes work on a physical device.

Prompts for Cursor, Claude Code & Codex

Paste these into Cursor, Claude Code, Codex, or any coding agent. Replace the bracketed parts with your app details, and keep the agent in plan mode first so you review the approach before it edits files.

Set up NativeWind

text
Set up NativeWind in this Expo project following the current official install guide for my SDK. Show each changed file (tailwind.config.js, global.css, babel.config.js, metro.config.js, root layout import). Then add a test view with bg-red-500 and explain how I verify it with npx expo start -c.

Rules, databases & blogs to use

Resources

Threads in the same domain as this chapter — go deeper on iHateReading without leaving the roadmap.

AI React Tailwind code generator app cover

AI React Tailwind code generator app

Generating Tailwind UI from prompts.

Fastest way to convert Figma design to React code cover

Fastest way to convert Figma design to React code

Design handoff to code with AI tools.

Anima vs Figma Make cover

Anima vs Figma Make

Design-to-code app builders compared.