-
Notifications
You must be signed in to change notification settings - Fork 41
feat: inline rtl support#574
Conversation
|
No actionable comments were generated in the recent review. 🎉 i️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughRTL variant now supports subtree-scoped direction overrides via inline ChangesSubtree-scoped RTL variant support
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Suggested reviewers
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧹 Nitpick comments (1)
packages/uniwind/src/core/native/store.ts (1)
254-264: 💤 Low valueConsider handling
direction: 'inherit'explicitly.The current implementation treats
direction: 'inherit'as LTR (since'inherit' !== 'rtl'). In React Native,'inherit'means the component should inherit direction from its parent, which would ultimately resolve to the global RTL setting. For consistency, you might want to fall back tothis.runtime.rtlwheninlineDir === 'inherit', similar to howundefinedis handled.♻️ Optional enhancement for inherit handling
private validateDir(rtl: boolean, props: Record<string, any> = {}) { const inlineDir = 'style' in props ? (StyleSheet.flatten(props.style) as ViewStyle)?.direction : undefined - if (inlineDir !== undefined) { + if (inlineDir !== undefined && inlineDir !== 'inherit') { const isInlineRtl = inlineDir === 'rtl' return isInlineRtl === rtl } return rtl === this.runtime.rtl }🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/uniwind/src/core/native/store.ts` around lines 254 - 264, The validateDir method currently treats inlineDir==='inherit' as not-RTL; update validateDir (which reads inlineDir from props.style via StyleSheet.flatten) to treat 'inherit' like undefined by falling back to this.runtime.rtl: if inlineDir === 'inherit' then resolve using this.runtime.rtl (so isInlineRtl is computed from runtime.rtl), otherwise keep existing inlineDir === 'rtl' behavior; adjust the return logic in validateDir to handle the 'inherit' case explicitly.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@packages/uniwind/src/core/native/store.ts`:
- Around line 254-264: The validateDir method currently treats
inlineDir==='inherit' as not-RTL; update validateDir (which reads inlineDir from
props.style via StyleSheet.flatten) to treat 'inherit' like undefined by falling
back to this.runtime.rtl: if inlineDir === 'inherit' then resolve using
this.runtime.rtl (so isInlineRtl is computed from runtime.rtl), otherwise keep
existing inlineDir === 'rtl' behavior; adjust the return logic in validateDir to
handle the 'inherit' case explicitly.
i️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 11c26498-7fb0-4858-9fa0-c5b4f70f47ce
📒 Files selected for processing (4)
packages/uniwind/src/bundler/css-processor/processor.tspackages/uniwind/src/core/native/store.tspackages/uniwind/tests/native/styles-parsing/dir.test.tsxpackages/uniwind/tests/setup.native.ts
@Brentlok I haven't checked much but on my POV it probably doesn't fix my issue
// See direction is somwhere above the tree <View style={{ direction: "rtl" }}> {/* rtl should work on this node*/} <View className="bg-blue-500 rtl:bg-red-500" /> </View>
but all test examples in the PR are using direct style on current node
istarkov
commented
Jun 10, 2026
Here are #576 failing tests
🚀 This pull request is included in v1.9.0. See Release v1.9.0 for release notes.
Uh oh!
There was an error while loading. Please reload this page.
fix #573
Summary by CodeRabbit