🌗 How to Set Up NativeWind with Expo React Native — Dark Mode + Themed Components + Custom Fonts
If you're building a React Native app with Expo and want to add Tailwind-like styling with theme support, NativeWind v4 is a perfect fit. It supports dark mode, custom fonts, and allows you to build design systems using Tailwind classes — right in your mobile app.
This guide walks you through how to:
Set up NativeWind v4 in Expo 53 (React Native)
Create a dark/light theme switcher with TailwindCSS
Integrate custom fonts with TailwindCSS
Build custom components like ThemedText, ThemedView, and ThemedButton
💡 Tip: If you're using an older version of Expo (prior to SDK 53), consider using NativeWind v2 instead. NativeWind v4 requires Expo SDK 53 or later for full compatibility.
✅ Why Use NativeWind?
Tailwind-like syntax for styling in React Native.
Supports dark mode and system themes.
Works perfectly with Expo and React Native Reanimated v3.
Helps you build consistent, scalable UI components.
📌 Note: You can use the latest versions of these packages, but the versions listed above are known to work perfectly with NativeWind v4 and Expo SDK 53, providing maximum compatibility and stability during setup.
2. Configure TailwindCSS
Create or edit tailwind.config.js:
js
1/** @type{import('tailwindcss').Config} */
2module.exports={
3content:[
4"./App.tsx",
5"./src/components/**/*.{js,jsx,ts,tsx}",
6"./src/app/**/*.{js,jsx,ts,tsx}",
7// Adjust these paths based on your project structure.
8// This example assumes all source code is under the `src` directory.
9],
10darkMode:"class",
11presets:[require("nativewind/preset")],
12theme:{
13extend:{
14// Setup font if you want to use custom font in React Native
✅ Installed and configured NativeWind v4 in Expo
✅ Built a dark mode toggle switch
✅ Integrate custom fonts with TailwindCSS
✅ Created reusable components like ThemedText and ThemedView
✅ Added a global design system using Tailwind
This setup allows you to move fast while maintaining a consistent and theme-aware design across your app.