`@effect/ui-native` (Effect-TS/ui): `Css.color` silently returns `undefined` for unparsed CSS colors (e.g. `oklch()` / `color-mix()`), violating its `Native.ProcessedColor` return type
I maintainer di solito rispondono entro 1 giorno
Valutazione
Questa issue non è ancora stata valutata.
Descrizione
partially generated with help of my ai friend - neon 4.4
Hi effect team,
I was trying out this package and wanted to report some bugs encountered while porting a library to effect native
What version of Effect is running?
effect:4.1.7@effect/ui&@effect/ui-native:Effect-TS/uimainat77391ee50ae3d3175d670facbf675e9a819ba6a6react-native:0.88.1
What steps can reproduce the bug?
- Clone the minimal reproduction repository:
git clone https://github.com/cliffordfajardo/effectui-native-error-reproductions.git cd effectui-native-error-reproductions pnpm install pnpm test - Call
Css.color(...)orCss.boxShadow(...)with a valid CSS Color Level 4 string (such asoklch(...)orcolor-mix(...), commonly used in modern CSS design tokens):
import type * as Native from "@effect/ui-native/Native"
import * as Css from "@effect/ui-native/kit/Css"
const oklch: Native.ProcessedColor = Css.color("oklch(0.6204 0.195 253.83)")
const colorMix: Native.ProcessedColor = Css.color(
"color-mix(in oklab, #000 50%, #fff)"
)
const shadows = Css.boxShadow("0 2px 8px oklch(0.6204 0.195 253.83)")
- Inspect the runtime values (see
02-css-color-returns-undefined-for-unparsed-colors/repro.test.ts).
What is the expected behavior?
Either:
Css.color(andCss.boxShadow) converts valid CSS Color Level 4 strings (or throws/fails explicitly on unsupported color strings) so the return value always satisfiesNative.ProcessedColor, orCss.color's return type accurately reflects React Native's?ProcessedColorValue(Native.ProcessedColor | null | undefined) so callers are forced to handle unparsed colors instead of silently passingundefinedinto Fabric style objects.
What do you see instead?
packages/ui-native/src/kit/Css.ts:140-141 types Css.color as returning a non-nullable, non-undefined Native.ProcessedColor:
export const color: (color: Native.Color) => Native.ProcessedColor =
processColor
where packages/ui-native/src/Native.ts:58-60 defines ProcessedColor as an opaque branded interface (excluding undefined and null), and packages/ui-native/src/kit/internal/processColor.ts:1 directly re-exports react-native/Libraries/StyleSheet/processColor.
In [email protected] (Libraries/StyleSheet/processColor.js:21-29), processColor has Flow return type ?ProcessedColorValue and returns undefined whenever normalizeColor(color) fails to parse the string (including CSS Color Level 4 formats like oklch(...) / color-mix(...) and malformed strings), or null when normalizedColor is not a number.
As a result:
Css.color("oklch(0.6204 0.195 253.83)")compiles with typeNative.ProcessedColor(even understrict: trueandexactOptionalPropertyTypes: true) yet evaluates toundefinedat runtime without throwing.Css.boxShadow("0 2px 8px oklch(0.6204 0.195 253.83)")silently returns[]becauseprocessBoxShadow.js:97-100aborts the entire shadow array whenprocessColorreturnsnull/undefined.
Additional information
When porting custom components backed by CSS custom properties (which frequently use oklch(...) / color-mix(...) in modern design systems), this manifests as views and shadows silently disappearing at runtime with no TypeScript error or dev-mode warning.
- Lingua principale
- TypeScript
- Stelle
- 16.7k
- Fork
- 808
- Merge medio
- 21h 22m
- PR unite (30g)
- 486
Preparare l'ambiente
Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di Effect-TS/effect
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
`@effect/ui-native` (Effect-TS/ui): `kit/VirtualList` `list` part widens `R` to `any`, poisoning enclosing componentsForse già presa @effect-bot l’ha presa oggi. Aperta
Effect-TS/effect#11097 · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
-
`@effect/ui-native` (Effect-TS/ui): Controlled `input` rejected-edit restore never calls `host.commit()`Forse già presa @effect-bot l’ha presa oggi. Aperta
Effect-TS/effect#11096 · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di Effect-TS/effect
Issue simili
-
check:failed streams:edit
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
iptv-org/iptv#60585 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 67/100
I maintainer di solito rispondono entro 1 giorno
-
[Bug]: Critical path skips a child span that ends exactly when the next one startsForse già presa @Piyush4801 l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
jaegertracing/jaeger-ui#4865 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 90/100
anthropics/claude-code#112972 ·
-
Type: Improvement
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
I maintainer di solito rispondono entro 1 giorno