NativeWind classes are ignored on React Navigation screens and components
className has no effectShort answer
NativeWind only styles components it can reach. Check the Tailwind content paths, the babel preset, the Metro wrapper and the global.css import. Navigation options like headers and tab bars take style objects, not className, so use a theme or remapProps for third-party components.
Fix it fast
1Find out which cause you have
Find out whether the failure is global or only inside navigation components. Put a plain View with a bright background class on any screen.
<View className="flex-1 bg-red-500" />2Match what you see, then jump to its fix
- 1
No class works anywhere, not only in navigation.The NativeWind setup is incompleteFix - 2
Classes work in components but not on screens in another folder.The screen files are not in the Tailwind content listFix - 3
className works on View and Text but not on a library component.A third-party component does not forward classNameFix - 4
Class works inside screens, but header, tab bar and screen background do not follow it.Navigation chrome is styled through its theme, not classesFix
- 1
What does the error look like?
className has no effectTailwind classes do not apply to navigation screens
Cause 1 of 4
The NativeWind setup is incomplete
1Check
Four pieces are needed: content paths in tailwind.config.js, the nativewind preset, the babel entries and the Metro wrapper with the CSS input. global.css must be imported once in the root.
cat tailwind.config.js babel.config.js metro.config.js
grep -rn "global.css" App.tsx app/_layout.tsx2Fix
Match the documented setup, and restart Metro afterwards.
// tailwind.config.js
content: ["./App.tsx", "./components/**/*.{js,jsx,ts,tsx}"],
presets: [require("nativewind/preset")],
// babel.config.js presets
["babel-preset-expo", { jsxImportSource: "nativewind" }],
"nativewind/babel",
// metro.config.js
module.exports = withNativeWind(config, { input: './global.css' })3Verify
Restart Metro and the red View shows.
npx expo start --clearConfirmed by nativewind.dev
Cause 2 of 4
The screen files are not in the Tailwind content list
1Check
The content list must name every file that uses NativeWind classes.
grep -n -A4 "content" tailwind.config.js2Fix
Add every folder that contains className, such as screens, to content.
content: [
"./App.tsx",
"./components/**/*.{js,jsx,ts,tsx}",
"./screens/**/*.{js,jsx,ts,tsx}",
],3Verify
Restart Metro and the class appears on the screen.
npx expo start --clearConfirmed by nativewind.dev
Cause 3 of 4
A third-party component does not forward className
1Check
If a component does not forward className to a style prop, the class is dropped silently.
grep -rn "className" src/ | head2Fix
Map className to the component's style props once, at the app entry point.
remapProps(ThirdPartyComponent, {
className: "style",
contentContainerClassName: "contentContainerStyle",
});3Verify
The class now changes the component.
# reload the appConfirmed by nativewind.dev
Cause 4 of 4
Navigation chrome is styled through its theme, not classes
1Check
React Navigation reads colors for backgrounds, headers and tab bars from its theme object.
grep -rn "NavigationContainer\|theme=" src/ app/2Fix
Pass a theme to the navigation container with your colors.
const MyTheme = {
...DefaultTheme,
colors: { ...DefaultTheme.colors, background: 'rgb(255, 255, 255)' },
};
<NavigationContainer theme={MyTheme}>3Verify
The screen background follows the theme color.
# reload and compare screensConfirmed by reactnavigation.org
How do I stop it coming back?
- Keep Tailwind content paths in sync when you add folders.
- Restart Metro after changing tailwind, babel or metro config.
- Use the theme for navigation chrome and className for your own components.
Sources
How was this page made?
I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.
Which stack is behind this page?
Projects of mine built on the same technologies:
- TaxiDexMy own multi-tenant taxi dispatch SaaS: API, dispatcher portal, driver and passenger apps, and the servers underneath.
- QistLockA NestJS and React SaaS driving an Android Device Owner agent that locks financed phones when payments lapse.
- TaskvareA task and project-management suite: React on the web, Flutter on mobile, TypeScript underneath.
Related fixes
Mobile apps
Android build stops at processDebugManifest in a React Native app
Manifest merger failed
processDebugManifest is the step that merges your AndroidManifest.xml with the manifests of every library.
2 causes, each with a fixMobile apps
Running pod on a React Native project fails with can't find gem cocoapods
can't find gem cocoapods (>= 0.a) with executable pod
The pod command exists, but the Ruby that is running it has no CocoaPods gem.
3 causes, each with a fixMobile apps
FormatException: Invalid radix-10 number when parsing a string to int
FormatException: Invalid radix-10 number
int.parse accepts only a whole-number literal.
3 causes, each with a fixMobile apps
React Native Android build cannot find the foojay-resolver-convention plugin
Plugin [id: 'org.gradle.toolchains.foojay-resolver-convention'] was not found in any of the following sources:
The foojay plugin is a settings plugin that Gradle downloads from the Plugin Portal.
3 causes, each with a fixMobile apps
Kotlin and Java compile to different JVM targets in a React Native Android build
'compileJava' task (current target is 1.8) and 'compileKotlin' task (current target is 11)
Gradle refuses to build when the Java task and the Kotlin task target different JVM versions.
3 causes, each with a fixMobile apps
Gradle cannot run node in a React Native Android build
Process 'command 'node'' finished with non-zero exit value 1
The React Native Gradle plugin starts node for bundling.
3 causes, each with a fix