Skip to content

Ignore undefined style values on native#484

Closed
adityasingh2400 wants to merge 1 commit into
react:mainfrom
adityasingh2400:fix/ignore-undefined-style-values
Closed

Ignore undefined style values on native#484
adityasingh2400 wants to merge 1 commit into
react:mainfrom
adityasingh2400:fix/ignore-undefined-style-values

Conversation

@adityasingh2400

Copy link
Copy Markdown

Fixes #452

On native, returning undefined for a property from an inline style function (or any style object with an undefined value) leaks that key through processStyle and into the style resolver, which throws styleq: <cssAtom> typeof undefined is not "string" or "null". This is a regression; these values used to be dropped, and on web undefined values are simply ignored.

The loop in processStyle branches on object/string/number, so an undefined value falls through to the catch-all assignment and ends up in the result as { rowGap: undefined }. This adds an early continue for undefined values so the property is omitted, matching web behavior and letting inline style functions return undefined to opt out of a property.

null is left untouched since the resolver accepts it.

Testing: added a regression test under css.create() > values: general that asserts the property is absent when the inline function returns undefined. Confirmed it fails on main and passes with the fix. Full native + web jest suites pass (888 tests, 711 snapshots unchanged), Flow and ESLint clean.

@MoOx

MoOx commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

Any reason you closed this ?

@adityasingh2400

Copy link
Copy Markdown
Author

Sorry @MoOx, no reason related to the change itself. I closed it by accident while bulk cleaning up stale forks on my profile, and since the fork got deleted I could not reopen this one directly. I have restored the exact same branch and opened #498 to continue it. Happy to address review feedback there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

styleq: <cssAtom> typeof undefined is not "string" or "null".

2 participants