fix: preserve start/end spacing properties#383
Conversation
📝 WalkthroughWalkthroughThe RN processor's CSS-to-React Native transformation now normalizes logical directional tokens (InlineStart/InlineEnd) to physical directions (Start/End) for padding and margin properties. Accompanying test cases verify these transformations produce expected paddingStart, paddingEnd, marginStart, and marginEnd values. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Poem
🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
No actionable comments were generated in the recent review. 🎉 Tip Issue Planner is now in beta. Read the docs and try it out! Share your feedback on Discord. 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. Comment |
There was a problem hiding this comment.
Pull request overview
This pull request fixes the transformation of CSS logical properties (padding-inline-start, padding-inline-end, margin-inline-start, margin-inline-end) to their React Native equivalents (paddingStart, paddingEnd, marginStart, marginEnd). Previously, these properties were incorrectly being transformed to non-existent properties like paddingHorizontalStart.
Changes:
- Added replacements for
InlineStart→StartandInlineEnd→Endbefore the generalInline→Horizontalreplacement - Added test cases for
ps-1,pe-1,ms-1, andme-1utilities to verify correct behavior
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| packages/uniwind/src/metro/processor/rn.ts | Added two new string replacements to handle InlineStart/InlineEnd before the general Inline replacement |
| packages/uniwind/tests/native/styles-parsing/spacing.test.tsx | Added test cases for padding-start, padding-end, margin-start, and margin-end utilities |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This pull request adds support for spacing utilities (
paddingStart,paddingEnd,marginStart,marginEnd).Previous behaviour was incorrectly replacing
InlineStartandInlineEndsuffixes withHorizontalStart/VerticalStart, which isn't correct.I added extra test cases to both padding and margin to make sure it resolves as expected without breaking the existing cases. Also tested it's working by applying a patch package to my app.
I tried to find any issues asking about this, but found none. Please let me know if this was intended for some reason, although I think this was missed by mistake.
Summary by CodeRabbit
New Features
Tests