Skip to content

fix: gracefully handle CSS syntax errors in React Native - #5680

Merged
quantizor merged 1 commit into
mainfrom
fix/rn-css-syntax-error-handling
Mar 19, 2026
Merged

quantizor merged 1 commit into
mainfrom
fix/rn-css-syntax-error-handling

Conversation

@quantizor

Copy link
Copy Markdown
Contributor

Summary

  • Wrap PostCSS parse() in try/catch in InlineStyle.ts
  • CSS syntax errors (missing semicolons, etc.) now log a dev warning and produce an empty style object instead of crashing the app
  • Restores the lenient behavior from v5

Test plan

  • All 37 native tests pass
  • All 501 web tests pass
  • Manual test with intentionally malformed CSS on RN

Closes #4361

Wrap PostCSS `parse()` in try/catch in InlineStyle.ts so that CSS
syntax errors (e.g., missing semicolons) produce a dev warning and
empty style object instead of crashing the app. This restores the
lenient behavior from v5.

Closes #4361
@changeset-bot

changeset-bot Bot commented Mar 19, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: bea06a3

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
styled-components Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@quantizor
quantizor marked this pull request as ready for review March 19, 2026 05:26
@quantizor
quantizor merged commit 5ef3804 into main Mar 19, 2026
5 checks passed
@quantizor
quantizor deleted the fix/rn-css-syntax-error-handling branch March 19, 2026 05:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

non-fatal css syntax errors are now fatal in v6

1 participant