rtl:/ltr: variants silently dropped — lightningcss downcompiles :dir() to :lang() which is unhandled
Los mantenedores suelen responder en 3 días
@YevheniiKotyrlo ya está trabajando en esto.
Desde el 22/9/2026.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 35/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Stack tecnológico
- css, react-native, typescript
Línea de trabajo
Start in selector-builder.ts at parseIsWhereComponents, comparing the existing case "dir" branch with the default branch that returns null for :lang(). Check how :where() handles [dir="rtl"] attribute selectors. Two open pull requests (#461, #472) already target this, so read them before starting. Done means an rtl: class applies its style when I18nManager.isRTL is true, and the existing selector tests still pass.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Describe the bug
The rtl: and ltr: variants from Tailwind CSS v4 are silently dropped during compilation. No error is produced — the styles simply never apply. Related to nativewind/nativewind#1433 but traced to a different root cause in the react-native-css v5 compiler.
Root cause
- Tailwind v4 generates
:dir(rtl)in thertl:variant (confirmed intailwindcsssource) - Lightningcss 1.30.1 downcompiles
:dir(rtl)to:is(:lang(ae), :lang(ar), ...)at the parse level parseIsWhereComponentsinselector-builder.tshas acase "dir"handler but nocase "lang"handler:lang()hitsdefault: { return null; }→ returns null- Inside
:where(),[dir="rtl"]attribute selectors also return null (line ~397) - ALL alternatives produce nothing → the entire rule is silently dropped
Key finding: Features.DirSelector does not help
Adding Features.DirSelector to lightningcss include list does NOT prevent the downcompile. Confirmed with a console.log verifying the flag IS loaded — the CSS output still contains :is(:lang(...)) instead of :dir(rtl). The downcompile happens at the parse level, before feature flags are consulted.
Proposed fix
Add a case "lang" handler to parseIsWhereComponents. Lightningcss expands :dir(rtl) into a fixed set of 19 RTL languages. Map these back to [=, "dir", "rtl"], leveraging the existing runtime case "dir" check against I18nManager.isRTL:
case "lang": {
const RTL_LANGUAGES = new Set([
"ae","ar","arc","bcc","bqi","ckb","dv","fa","glk",
"he","ku","mzn","nqo","pnb","ps","sd","ug","ur","yi"
]);
const direction = component.languages?.[0] && RTL_LANGUAGES.has(component.languages[0]) ? "rtl" : "ltr";
queries ??= [{ specificity: [] }];
queries.forEach(query => {
getMediaQuery(query).push(["=", "dir", direction]);
});
return parseIsWhereComponents(type, selector, index + 1, queries);
}
Reproduction
- Bug branch: https://github.com/Noitidart/nativewind-v5-rtl-bugs/tree/issue-2-rtl-variant-dropped
- Fix branch (patch-package): https://github.com/Noitidart/nativewind-v5-rtl-bugs/tree/issue-2-rtl-variant-dropped-fix
Steps:
npm install && npx expo run:ios- Press "Force RTL" button
- Fully restart the app
- The
rtl:bg-amber-400class should make the background amber, but it stays blue
Expected behavior
rtl:bg-amber-400 should apply background-color: amber-400 when I18nManager.isRTL === true.
Workaround
Use patch-package with the patch from the fix branch.
Environment
- react-native-css: 3.0.7
- nativewind: 5.0.0-preview.4
- react-native: 0.86.0
- expo: 57
- Lenguaje dominante
- TypeScript
- Estrellas
- 166
- Forks
- 45
- Merge medio
- 13 d 14 h
- PR fusionados (30 d)
- 1
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Sin plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de nativewind/react-native-css
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
nativewind/react-native-css#545 ·
Los mantenedores suelen responder en 3 días
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
nativewind/react-native-css#544 ·
Los mantenedores suelen responder en 3 días
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
nativewind/react-native-css#543 ·
Los mantenedores suelen responder en 3 días
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
nativewind/react-native-css#540 ·
Los mantenedores suelen responder en 3 días
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
nativewind/react-native-css#538 ·
Los mantenedores suelen responder en 3 días
Todos los issues de nativewind/react-native-css
Issues similares
-
Replace discontinued crypto-js in the themePosiblemente ocupada @aelmanaa la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
PaloAltoNetworks/docusaurus-openapi-docs#1689 ·
Los mantenedores suelen responder en 2 días
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
solana-foundation/solana-web3.js#4015 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
formatSearchQuery drops the :present modifier, so `email:present=true` is sent as `email=true`Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
Los mantenedores suelen responder en 1 día
-
documentation
Dificultad 1/5 1-3 horas Aptitud para principiantes 90/100
ivopogace/opencode-courier#422 ·
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
chapel-lang/chapel-vscode#158 ·
Los mantenedores suelen responder en 1 día