Overview
This guide covers common issues you might encounter when using NativeWind and their solutions. If you don’t find your issue here, check the GitHub issues or join our Discord.Always start by clearing your Metro cache:
npx expo start --clear or npx react-native start --reset-cacheInstallation Issues
Styles not applying after installation
Styles not applying after installation
Problem: Installed NativeWind but styles don’t appear.Solution:
Module not found errors
Module not found errors
Problem:
Cannot find module 'nativewind/metro' or similar errors.Solution:-
Delete and reinstall dependencies:
-
Check peer dependencies:
-
Ensure correct imports:
Note: v4 uses
withNativeWind, v5 useswithNativewind(lowercase ‘w’)
Peer dependency warnings
Peer dependency warnings
Problem: npm warns about peer dependency conflicts.Solution:NativeWind v5 requires:For v4 projects:
tailwindcss >4.1.11react-native-css ^3.0.1
Configuration Issues
Metro bundler fails to start
Metro bundler fails to start
Problem: Metro crashes or shows configuration errors.Solutions:1. Check Metro config syntax:2. For monorepos, configure node_modules paths:3. Restart with clean cache:
metro.config.js
metro.config.js
PostCSS configuration errors
PostCSS configuration errors
Problem: PostCSS fails to process CSS or shows plugin errors.Solution:Create Install the PostCSS plugin:
postcss.config.mjs (note the .mjs extension):postcss.config.mjs
global.css not found
global.css not found
Problem: Error:
Cannot find module './global.css'Solution:-
Create the file in your project root (or
src/):global.css -
Import with correct path:
App.tsx
-
Include in tsconfig.json:
tsconfig.json
TypeScript Issues
className property not recognized
className property not recognized
Problem: TypeScript error:
Property 'className' does not exist on type 'ViewProps'Solution:Type generation disabled
Type generation disabled
Problem: If you manage types manually:
nativewind-env.d.ts not being generated.Solution:Check if you disabled generation in Metro config:metro.config.js
tsconfig.json
Conflicting type declarations
Conflicting type declarations
Problem: Multiple declaration errors for React Native components.Solution:
-
Remove duplicate type references:
-
Use only auto-generated types:
metro.config.js
-
Or use manual types only:
metro.config.jstsconfig.json
Runtime Issues
Styles not updating in development
Styles not updating in development
Problem: CSS changes don’t reflect in the app.Solution:
-
Enable Fast Refresh:
app.config.ts
-
Clear Metro cache:
-
Check file watching:
metro.config.js
-
Reload the app manually:
- iOS Simulator:
Cmd + R - Android Emulator:
R + R(double press) - Physical device: Shake and select “Reload”
- iOS Simulator:
react-native-safe-area-context crash
react-native-safe-area-context crash
Problem: App crashes with safe area context error.Fixed in v4.1.22: NativeWind now gracefully handles missing Or install safe area context:And wrap your app:
react-native-safe-area-context.Solution:Update to latest version:App.tsx
Windows build issues
Windows build issues
Problem: Building fails on Windows.Fixed in v4.1.22: Windows build issues resolved.Solution:
-
Update to latest:
-
Use forward slashes in paths:
metro.config.js
-
Clear cache and rebuild:
Styling Issues
Dark mode not working
Dark mode not working
Problem: Dark mode classes don’t apply.Solution:
-
Set userInterfaceStyle in app config:
app.config.ts
-
Use dark: modifier:
-
Check color scheme hook:
Custom colors not working
Custom colors not working
Problem: Custom theme colors don’t apply.Solution for v5:Define colors in Usage:
global.css using @theme:global.css
Platform modifiers not working
Platform modifiers not working
Problem:
ios: or android: modifiers don’t work.Solution:-
Verify NativeWind theme is imported:
global.css
-
Use correct syntax:
- Test on actual platform: Platform modifiers only apply on their respective platforms.
Flexbox not working as expected
Flexbox not working as expected
Problem: Flex layouts don’t work like web.Solution:React Native has different flexbox defaults:
React Native’s flexbox differs from web:
- Default
flexDirectioniscolumn(web isrow) flex: 1is commonly used (meansflex-grow: 1, flex-shrink: 1, flex-basis: 0)
Build and Production Issues
Production build fails
Production build fails
Problem: App builds in development but fails in production.Solution:
-
Clear all caches:
-
Rebuild native code:
-
Check for development-only code:
Ensure no
__DEV__only styles or imports.
Large bundle size
Large bundle size
Problem: App bundle is too large.NativeWind processes styles at build time, so unused utilities are removed automatically.Additional optimizations:
- Verify tree-shaking is working: Check that unused Tailwind classes aren’t in the bundle.
- Minimize custom CSS: Avoid importing large CSS files or libraries.
-
Analyze bundle:
Debugging Tips
Getting Help
If you’re still experiencing issues:GitHub Issues
Search existing issues or create a new one with a reproduction
Discord Community
Ask questions and get help from the community
Contributing
Learn how to contribute bug fixes
Documentation
Browse the full documentation
Reporting Issues
When reporting an issue, include:- NativeWind version:
npm list nativewind - React Native version: Check
package.json - Platform: iOS, Android, Web, or specific device
- Minimal reproduction: Use
npx rn-new@latest --nativewind - Steps to reproduce: Clear step-by-step instructions
- Expected vs actual behavior: What you expected vs what happened
- Relevant code: Metro config, global.css, component code
Next Steps
Configuration
Review configuration guide
Migration
Upgrade to latest version
TypeScript
Fix TypeScript issues
Custom Styles
Learn custom styling patterns