Key Differences
Before starting the migration, it’s important to understand how Uniwind differs from Nativewind:Uniwind supports Tailwind 4 only. Make sure you upgrade Tailwind CSS to version 4.
- Default rem value: Uniwind uses
16pxas the default value for theremunit - No global overrides: We don’t override global components like Nativewind’s
cssInterop - CSS-based theming: Themes are defined in CSS files instead of
tailwind.config.js - No ThemeProvider required: Uniwind doesn’t require wrapping your app in a
ThemeProviderto switch themes
Prerequisites
Nativewind depends on the following packages:react-native-reanimatedreact-native-safe-area-contexttailwindcss
We recommend keeping both
react-native-reanimated and react-native-safe-area-context in your project, as they are very useful for React Native development.Migration Steps
Step 1: Install Uniwind
Follow the Quickstart guide to install Uniwind in your project.Step 2: Remove Nativewind Babel preset
Remove the Nativewind Babel preset from yourbabel.config.js file:
babel.config.js
Step 3: Update Metro configuration
Modify yourmetro.config.js to remove the Nativewind configuration and use Uniwind’s configuration instead:
metro.config.js
Learn more about Metro configuration in the Metro Config documentation.
Step 4: Update your global CSS file
Replace the top of yourglobal.css file with the following imports:
global.css
Step 5: Remove Nativewind type definitions
Delete thenativewind.d.ts file from your project, as it’s no longer needed.
Step 6: Convert your CSS to Tailwind 4 syntax
You can keep most of your existing CSS as-is, but you’ll need to follow Tailwind 4’s@theme syntax for theme configuration.
Step 7: Migrate theme variables from JavaScript to CSS
If you defined custom theme variables using Nativewind’svars helper:
Before: JavaScript theme configuration
Before: JavaScript theme configuration
vars.ts
After: CSS theme configuration
After: CSS theme configuration
Move these variables directly to your
global.css file:global.css
If you need to access CSS variables in JavaScript, you can use
useResolveClassNames hook.Step 8: Remove tailwind.config.js
With Uniwind, you no longer need atailwind.config.js file. Theme configuration is now done entirely in CSS.
Example: Old tailwind.config.js
Example: Old tailwind.config.js
tailwind.config.js
Step 9: Migrate font families from tailwind.config.js
If you customized fonts in yourtailwind.config.js, you’ll need to move them to your global.css file. Unlike Tailwind CSS on the web, React Native doesn’t support font fallbacks, so you must specify only a single font family.
Before: tailwind.config.js with font fallbacks
Before: tailwind.config.js with font fallbacks
tailwind.config.js
After: global.css with single fonts
After: global.css with single fonts
Move font definitions to your Usage:
global.css using the @theme directive, specifying only the actual font file name:global.css
React Native requires separate font files for each weight. Don’t include fallback fonts like
sans-serif or monospace - only use the exact font file name.Custom Fonts FAQ
Learn how to load and configure custom fonts in your React Native app
Step 10: (Optional) Customize the default rem value
If you want to keep Nativewind’s defaultrem value of 14px, configure it in your metro.config.js:
metro.config.js
Step 11: Remove ThemeContext where you set colorScheme
Uniwind doesn’t require a ThemeProvider to manage themes. Simply remove it from your app:
Before: With ThemeProvider
Before: With ThemeProvider
ThemeProvider.tsx
App.tsx
After: Without ThemeProvider
After: Without ThemeProvider
App.tsx
Step 12: Replace cssInterop with withUniwind
If you’re using Nativewind’s cssInterop to style third-party components, replace it with Uniwind’s withUniwind:
Learn more about
withUniwind in the withUniwind API documentation.Step 13: Handle safe area utilities
If you used Nativewind’sp-safe or m-safe class names, you’ll need to use the useSafeAreaInsets hook from react-native-safe-area-context instead:
Before: Using p-safe
Before: Using p-safe
After: Using useSafeAreaInsets
After: Using useSafeAreaInsets
Step 14: Update animated class names
If you used Nativewind’sanimated class names from Tailwind, you’ll need to use Reanimated’s syntax directly.
Step 15: className dedupe and specificity
Unlike Nativewind, Uniwind does not automatically deduplicate classNames, especially on web. If you have conflicting styles likeclassName="bg-red-500 bg-blue-500", both classes will be applied and the behavior depends on CSS specificity rules. We recommend using tailwind-merge to properly merge and deduplicate classNames in your components.
Learn how to set up and use
tailwind-merge with the cn utility in our FAQ section.Need Help?
Missing Features?
If you’re using Nativewind and notice any missing features in Uniwind, please open an issue on GitHub. We’re happy to add support!
Still having issues with migration? Start a discussion on GitHub and we’ll help you migrate.