Overview
ThewithUniwindConfig function configures Uniwind in your Metro bundler. This is required to enable CSS processing, type generation, and theme support in your React Native application.
All Metro configuration changes require a Metro bundler restart to take effect. Clear the cache with
npx expo start --clear if you encounter issues.Basic Usage
Import and wrap your Metro config withwithUniwindConfig:
metro.config.js
Configuration Options
cssEntryFile
The relative path to your CSS entry file from the project root. This file should contain your Tailwind imports and custom CSS.
metro.config.js
global.css
extraThemes
An array of custom theme names beyond the default
light and dark themes. Each theme must be defined in your CSS using the @variant directive.metro.config.js
global.css
Custom Themes
Learn more about creating and managing custom themes
dtsFile
The path where Uniwind will auto-generate TypeScript type definitions for your CSS classes and themes. Defaults to
./uniwind-types.d.ts in your project root.metro.config.js
Place the
.d.ts file in your src or app directory for automatic TypeScript inclusion. For custom paths outside these directories, add the file to your tsconfig.json.tsconfig.json
polyfills
Configuration for CSS unit polyfills and adjustments to ensure cross-platform consistency.
polyfills.rem
The base font size (in pixels) used for rem unit calculations. Defaults to
16, which is the standard browser default.metro.config.js
- Your design system uses a different base font size
- You need to scale your entire UI proportionally
- You’re migrating from a web app with a custom rem base
- You’re migrating from Nativewind
isTV
Available in Uniwind 1.5.0+Enable TV platform support for Apple TV and Android TV. When enabled, Uniwind recognizes
tv:, apple-tv:, and android-tv: platform selectors and @variant directives.metro.config.js
When
isTV is enabled, Uniwind maps ios to apple-tv and android to android-tv at build time. The tv: selector targets both TV platforms, similar to how native: targets both iOS and Android.Platform Selectors
Learn about TV platform selectors and focus-based styling
debug
Enable debug mode to identify unsupported CSS properties and classNames. When enabled, Uniwind will log errors for web-specific CSS that doesn’t work in React Native.
metro.config.js
Complete Configuration Example
Here’s a full example with all options configured:metro.config.js
Bare React Native
For bare React Native projects (non-Expo), use the@react-native/metro-config package:
metro.config.js
Related
Quickstart
Get started with Uniwind in 3 minutes
Monorepos & @source
Learn how to include components from multiple directories
Custom Themes
Create and manage custom themes beyond light and dark
Global CSS
Configure global styles and CSS variables
Theming Basics
Learn the fundamentals of theming in Uniwind