Overview
This guide helps you migrate between different versions of NativeWind. NativeWind has evolved significantly, with major changes between v2, v4, and v5.Version Overview
v2 (Legacy)
Original version using custom runtime
v4.1 (Stable)
Current stable release with Tailwind CSS v3 support
v5 (Preview)
Preview release with Tailwind CSS v4 support
Quick Start New Projects
For new projects, use the quickstart templates:Migrating from v2 to v4
NativeWind v4 introduced significant changes to improve performance and compatibility.Update dependencies
Update to the latest v4 release:
v4 uses Tailwind CSS v3, while v5 uses Tailwind CSS v4
Update configuration
The configuration API changed in v4. Update your configs:Before (v2):After (v4):
tailwind.config.js
tailwind.config.js
Check for breaking changes
Review the v4 changelog for breaking changes affecting your code.
Migrating from v4 to v5 (Preview)
NativeWind v5 adopts Tailwind CSS v4’s new CSS-first configuration system.Migrate to CSS-based configuration
Remove After (v5 - global.css):
tailwind.config.js and create global.css:Before (v4 - tailwind.config.js):global.css
Update Metro config
The Metro wrapper API is simpler in v5:Before (v4):After (v5):
metro.config.js
metro.config.js
Update custom utilities
Custom utilities now use CSS After (v5 - global.css):
@utility directive:Before (v4 - tailwind.config.js):Breaking Changes by Version
v4.1.23 (Latest Stable)
Changelog
Changelog
Patch Changes:
- Fixed incorrect template string in platformPath
- Updated dependencies:
react-native-css-interop@0.1.22
v4.1.22
Changelog
Changelog
Patch Changes:
- Fixed building apps locally on Windows
- Fixed crash when
react-native-safe-area-contextis not installed - Changed lightningcss to be a version range
- Updated dependencies:
react-native-css-interop@0.1.21
react-native-safe-area-context installed, this version now handles it gracefully.v4.0.0
Major changes from v2
Major changes from v2
Breaking Changes:
- Configuration: Requires Metro and Babel setup
- Tailwind Config: Must use nativewind preset
- CSS Entry: Requires global.css import
- Hooks: Some hooks moved to React Native core
- Build-time Processing: Styles now compiled at build time
- Significantly better performance
- Smaller bundle size
- Better compatibility with React Native updates
- Support for all Tailwind features
v2.0.11 and Earlier
Legacy v2 changes
Legacy v2 changes
v2.0.11:
- Fixed useInteraction types
- Added missing flexBasis from flex-1
- Fixed “unable to find styles” console warning
- Fixed compiling styles during mode:transformOnly
- Fixed cache invalidation for tailwind.config.js
- Removed addExternalDependency from babel
- Fixed null values when rendering styled children
Platform-Specific Migration
Expo Projects
React Native CLI Projects
Common Migration Issues
Styles not applying after migration
Styles not applying after migration
Solution:
- Clear Metro cache:
npx expo start --clear - Verify
global.cssis imported in your app entry - Check Metro config includes
withNativewind - Ensure all dependencies are correct versions
TypeScript errors after upgrade
TypeScript errors after upgrade
Solution:
- Delete
nativewind-env.d.ts - Restart Metro:
npx expo start --clear - Restart TypeScript server in your IDE
- Verify
nativewind-env.d.tsis regenerated and included intsconfig.json
Build failures after migration
Build failures after migration
Solution:
- Delete
node_modulesand lockfile - Run clean install:
npm cioryarn install - Clear all caches:
npx expo start --clear - For iOS:
cd ios && pod install && cd .. - Rebuild:
npx expo run:iosornpx expo run:android
Custom theme not working (v4 to v5)
Custom theme not working (v4 to v5)
Solution: Migrate theme configuration to CSS:
global.css
Testing After Migration
Verify your migration was successful:Visual inspection
- Run your app:
npm start - Check all screens render correctly
- Test dark mode if you use it
- Verify custom colors and spacing
Getting Help
If you encounter issues during migration:Troubleshooting Guide
Common issues and solutions
GitHub Issues
Report bugs or ask questions
Discord Community
Get help from the community
Contributing
Contribute fixes and improvements
Next Steps
Configuration
Fine-tune your setup
TypeScript
Configure TypeScript
Custom Styles
Create custom utilities