feat: parse inline-start inline-end border to RN#515
Conversation
📝 WalkthroughWalkthroughThis PR adds support for inline-start/inline-end border properties ( Changes
Possibly related PRs
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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.
🧹 Nitpick comments (1)
packages/uniwind/src/metro/processor/rn.ts (1)
189-205: Optional: consolidate the sharedInlineStart/InlineEndrewrites.The padding/margin and border branches both perform the identical
InlineStart→Start/InlineEnd→Endsubstitutions. You could lift those two replaces out so the branches only carry their unique parts, which keeps future logical-property additions in one place.♻️ Suggested consolidation
x => { + if (x.includes('padding') || x.includes('margin') || x.includes('border')) { + x = x + .replace('InlineStart', 'Start') + .replace('InlineEnd', 'End') + } + if (x.includes('padding') || x.includes('margin')) { return x - .replace('InlineStart', 'Start') - .replace('InlineEnd', 'End') .replace('Inline', 'Horizontal') .replace('Block', 'Vertical') } - if (x.includes('border')) { - return x - .replace('InlineStart', 'Start') - .replace('InlineEnd', 'End') - } - return x },🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/uniwind/src/metro/processor/rn.ts` around lines 189 - 205, The two branches inside the arrow function handling x (the mapper passed to the processor) duplicate the InlineStart→Start and InlineEnd→End replacements; refactor by first applying x = x.replace('InlineStart','Start').replace('InlineEnd','End') (or assign to a temp like normalized = x.replace(...)) and then keep the padding/margin branch to apply .replace('Inline','Horizontal').replace('Block','Vertical') and the border branch to do nothing extra (or only the border-specific transforms), returning the transformed value; update the arrow function that checks x.includes('padding') || x.includes('margin') and x.includes('border') to use the normalized value to avoid duplicate replace calls.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@packages/uniwind/src/metro/processor/rn.ts`:
- Around line 189-205: The two branches inside the arrow function handling x
(the mapper passed to the processor) duplicate the InlineStart→Start and
InlineEnd→End replacements; refactor by first applying x =
x.replace('InlineStart','Start').replace('InlineEnd','End') (or assign to a temp
like normalized = x.replace(...)) and then keep the padding/margin branch to
apply .replace('Inline','Horizontal').replace('Block','Vertical') and the border
branch to do nothing extra (or only the border-specific transforms), returning
the transformed value; update the arrow function that checks
x.includes('padding') || x.includes('margin') and x.includes('border') to use
the normalized value to avoid duplicate replace calls.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 8753d937-6cf7-4c94-976a-3bc3542b7e73
📒 Files selected for processing (3)
apps/expo-example/App.tsxpackages/uniwind/src/metro/processor/rn.tspackages/uniwind/tests/native/styles-parsing/borders.test.tsx
|
🚀 This pull request is included in v1.6.4. See Release v1.6.4 for release notes. |
fixes #511
Summary by CodeRabbit
Release Notes
New Features
border-s-*(start) andborder-e-*(end) directional border properties with customizable colors and widthsTests