nativewind

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese
Skill is based on NativeWind v5 (Tailwind CSS v4), generated at 2026-02-26.
NativeWind compiles Tailwind CSS for React Native:
className
on components, StyleSheet.create on native and reuse of the Tailwind stylesheet on web. It supports media/container queries, pseudo-classes (hover, focus, active), platform variants (ios:, android:, native:, web:), dark mode, and custom theme/utilities via CSS-first config.
本Skill基于NativeWind v5(Tailwind CSS v4)构建,生成时间为2026-02-26。
NativeWind可为React Native编译Tailwind CSS:在组件上使用
className
,在原生平台使用StyleSheet.create,在Web端复用Tailwind样式表。它支持媒体/容器查询、伪类(hover、focus、active)、平台变体(ios:、android:、native:、web:)、深色模式,以及通过CSS优先配置实现自定义主题/工具类。

Core References

核心参考

TopicDescriptionReference
SetupCSS file, Metro withNativewind, PostCSS, app entry, optional lightningcss pincore-setup
ConfigurationCSS-first config, @theme, @source, nativewind/theme, custom utilities/variantscore-config
v5 Tailwind foundationBuilt on Tailwind v4, CSS-first, web vs native supportcore-v5-tailwind-foundation
v5 Unitspx, %, vw/vh, rem, em on native; dp vs px; rem sizingcore-v5-units
v5 Functions & directives@import, @theme, @utility; var(), calc(), env(), color-mix(); RN functionscore-v5-functions-directives
v5 Style specificityOrder of precedence, !important, merging className and stylecore-v5-style-specificity
主题说明参考链接
配置CSS文件、Metro withNativeWind、PostCSS、应用入口、可选的lightningcss固定版本core-setup
配置项CSS优先配置、@theme、@source、nativewind/theme、自定义工具类/变体core-config
v5 Tailwind基础基于Tailwind v4构建、CSS优先、Web与原生平台支持core-v5-tailwind-foundation
v5 单位原生平台支持px、%、vw/vh、rem、em;dp与px对比;rem尺寸设置core-v5-units
v5 函数与指令@import、@theme、@utility;var()、calc()、env()、color-mix();RN函数core-v5-functions-directives
v5 样式优先级优先级顺序、!important、className与style合并core-v5-style-specificity

Features

功能特性

TopicDescriptionReference
Styling componentsclassName usage, custom vs third-party, styled() / cssInterop / remapProps, nativeStyleToPropfeatures-styling
Platform & responsivePlatform variants, units, breakpoints, safe-area utilitiesfeatures-platform
v5 ResponsiveBreakpoints on native, media queries, platform media, reactive updatesfeatures-v5-responsive
States & dark modehover/focus/active, disabled/empty, group modifiers, dark:, data attributesfeatures-states
v5 States & pseudo-classesDetailed pseudo-class table, selection/placeholder, group, ltr/rtlfeatures-v5-states-pseudo
v5 Third-party guideWhen className isn't passed, multiple style props, dynamic mapping @propfeatures-v5-third-party-guide
Theming & colors@theme tokens, vars() for runtime CSS variables, color behavioradvanced-theme
主题说明参考链接
组件样式设置className用法、自定义与第三方组件、styled() / cssInterop / remapProps、nativeStyleToPropfeatures-styling
平台与响应式平台变体、单位、断点、安全区域工具类features-platform
v5 响应式原生平台断点、媒体查询、平台媒体查询、响应式更新features-v5-responsive
状态与深色模式hover/focus/active、disabled/empty、组修饰符、dark:、数据属性features-states
v5 状态与伪类详细伪类表、selection/placeholder、组、ltr/rtlfeatures-v5-states-pseudo
v5 第三方组件指南未传递className时的处理、多样式属性、动态映射@propfeatures-v5-third-party-guide
主题与颜色@theme令牌、vars()实现运行时CSS变量、颜色行为advanced-theme

API (v5)

API(v5版本)

TopicDescriptionReference
withNativewindMetro wrapper options (globalClassNamePolyfill, typescriptEnvPath)api-with-nativewind
styledThird-party components, nativeStyleToProp, multiple className propsapi-styled
vars & runtime variablesvars(), VariableContextProvider, useUnstableNativeVariableapi-vars-runtime
cssInterop / remapPropsLegacy API (deprecated; use styled) — migration referenceapi-css-interop-remap
主题说明参考链接
withNativeWindMetro包装器选项(globalClassNamePolyfill、typescriptEnvPath)api-with-nativewind
styled第三方组件、nativeStyleToProp、多className属性api-styled
vars与运行时变量vars()、VariableContextProvider、useUnstableNativeVariableapi-vars-runtime
cssInterop / remapProps旧版API(已废弃;请使用styled)——迁移参考api-css-interop-remap

Advanced

进阶内容

TopicDescriptionReference
Migrate v4 → v5Steps, breaking changes, deprecationsadvanced-migrate-v4
主题说明参考链接
从v4迁移至v5步骤、破坏性变更、废弃项advanced-migrate-v4

Best Practices

最佳实践

TopicDescriptionReference
Correctness & debuggingExplicit light/dark, colors on Text not View, cache, DEBUG, verifyInstallationbest-practices-performance
v5 DeprecationsuseColorScheme → RN, cssInterop/remapProps → styled, @prop modifierbest-practices-v5-deprecations
主题说明参考链接
正确性与调试显式设置亮色/深色模式、在Text而非View上设置颜色、缓存、DEBUG、verifyInstallationbest-practices-performance
v5 废弃项useColorScheme → RN、cssInterop/remapProps → styled、@prop修饰符best-practices-v5-deprecations