Skip to content

fix(Reanimated): trim padded string values in the props builder - #10422

Merged
MatiPl01 merged 6 commits into
mainfrom
@matipl01/trim-string-style-values
Sep 15, 2026
Merged

MatiPl01 merged 6 commits into
mainfrom
@matipl01/trim-string-style-values

Conversation

@MatiPl01

@MatiPl01 MatiPl01 commented Aug 26, 2026

Copy link
Copy Markdown
Member

Summary

Trim string values in one shared processStyleValue boundary before invoking style processors. This covers regular styles, animated transform/transformOrigin, and nested SVG gradient stops while leaving pass-through properties unchanged and removing duplicate outer trims from individual processors.

Test plan

  • Added props-builder and real style-config coverage for padded strings.
  • Added SVG gradient stop coverage for padded offsets and opacity.
  • Reanimated, Worklets, monorepo, build, and changelog checks pass.

@MatiPl01 MatiPl01 self-assigned this Aug 26, 2026
@coderabbitai

coderabbitai Bot commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

Review Change StackReview Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • No new commits to review - use @coderabbitai full review for a full pass

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: ede65228-e8d5-4097-8814-3b9f9e4b9b07

📥 Commits

Reviewing files that changed from the base of the PR and between dfca141 and 288e5a7.

📒 Files selected for processing (1)
  • packages/react-native-reanimated/CHANGELOG.md
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/react-native-reanimated/CHANGELOG.md

Included review availability: Your plan provides up to 10 included reviews per hour; 7 remain after this review.


📝 Walkthrough

Walkthrough

The props builder now trims string values before processing. Style tests cover individual and mixed properties. SVG number-array processing no longer trims locally, and percentage processing trims before parsing. New tests cover padded SVG values, percentage conversion, and clamping. The changelog records the fix.

Priority: ⬇️ Low

Change: Bug fix

Merge Risk: ⚪ Minimal · up to 288e5

The reviewed change has no identified merge-blocking risk.

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description check ✅ Passed The description accurately summarizes the shared string-trimming change, affected style paths, tests, and validation results.
Title check ✅ Passed The title clearly identifies the main change: trimming padded string values in the props builder.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 9cfdbc96-3649-4b28-8e7d-ecb32e4a8483

📥 Commits

Reviewing files that changed from the base of the PR and between a657530 and bc856de.

📒 Files selected for processing (8)
  • packages/react-native-reanimated/CHANGELOG.md
  • packages/react-native-reanimated/src/common/style/__tests__/createPropsBuilder.test.ts
  • packages/react-native-reanimated/src/common/style/__tests__/stylePropsBuilder.test.ts
  • packages/react-native-reanimated/src/common/style/createPropsBuilder.ts
  • packages/react-native-reanimated/src/common/style/processors/__tests__/transform.test.ts
  • packages/react-native-reanimated/src/common/style/processors/__tests__/transformOrigin.test.ts
  • packages/react-native-reanimated/src/common/style/processors/transform.ts
  • packages/react-native-reanimated/src/common/style/processors/transformOrigin.ts
💤 Files with no reviewable changes (3)
  • packages/react-native-reanimated/src/common/style/processors/transform.ts
  • packages/react-native-reanimated/src/common/style/processors/tests/transformOrigin.test.ts
  • packages/react-native-reanimated/src/common/style/processors/tests/transform.test.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 7 remain after this review.

@MatiPl01
MatiPl01 force-pushed the @matipl01/trim-string-style-values branch 2 times, most recently from dfca141 to 288e5a7 Compare September 11, 2026 12:20
CSS strips the whitespace around a declaration value, so a padded string
has to parse like a bare one. Only transform and transformOrigin did that,
each with its own trim, while a padded color or font weight threw and a
padded gap was forwarded to the shadow node with the padding intact.

Trimming once in the build loop covers every processor-backed property,
so the two local trims are gone and processors can assume a clean string.
Properties configured as pass-through are left alone: their values reach
React Native untouched, exactly as they do outside an animated style.
processPercentage trimmed the value to test for the '%' suffix but sliced the
untrimmed string, so trailing whitespace left the '%' inside the number and
the result fell back to 1. Leading whitespace survived only because Number()
skips it. Gradient stops reach the processor through processSVGGradientStops,
which reads offset and opacity from inside an array the props builder never
descends into, so the padding is still there.

processNumberArray runs behind a props builder only, and that now trims for
it, so its own trim is gone.
@MatiPl01
MatiPl01 force-pushed the @matipl01/trim-string-style-values branch from 9320a45 to 499caec Compare September 11, 2026 12:44
@MatiPl01
MatiPl01 requested a review from pawicao September 11, 2026 13:41
@MatiPl01
MatiPl01 merged commit 2ec177b into main Sep 15, 2026
22 of 23 checks passed
@MatiPl01
MatiPl01 deleted the @matipl01/trim-string-style-values branch September 15, 2026 11:31
LKuchno pushed a commit that referenced this pull request Sep 16, 2026
## Summary

Trim string values in one shared `processStyleValue` boundary before
invoking style processors. This covers regular styles, animated
`transform`/`transformOrigin`, and nested SVG gradient stops while
leaving pass-through properties unchanged and removing duplicate outer
trims from individual processors.

## Test plan

- Added props-builder and real style-config coverage for padded strings.
- Added SVG gradient stop coverage for padded offsets and opacity.
- Reanimated, Worklets, monorepo, build, and changelog checks pass.
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.

2 participants