-
Notifications
You must be signed in to change notification settings - Fork 293
feat: enhance SafeArea with className/style props and constant() iOS fallback#3388
feat: enhance SafeArea with className/style props and constant() iOS fallback #3388bigbigDreamer wants to merge 2 commits intojdf2e:feat_v3.x from
Conversation
Walkthrough新增对安全区域的常数型 inset 支持(使用 Changes
Sequence Diagram(s)sequenceDiagram
participant App as 使用者组件
participant SafeArea as SafeArea (Web/Taro)
participant DOM as 根元素 (div/View)
Note over App,SafeArea: 渲染流程(高层)
App->>SafeArea: 传入 props (className, style, position, children, ...)
SafeArea->>SafeArea: 解构 props,合并 className 与 position
SafeArea->>DOM: 透传 `...rest`,应用 `style` 和 合并后的 className
DOM-->>App: 渲染包含 children 的根元素
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 分钟
Possibly related PRs
Suggested reviewers
Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
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 |
Codecov Report
✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.16%. Comparing base (e9a80b8) to head (68a1e1d).
Additional details and impacted files
@@ Coverage Diff @@ ## feat_v3.x #3388 +/- ## ========================================== Coverage 88.15% 88.16% ========================================== Files 291 291 Lines 19212 19216 +4 Branches 2988 2988 ========================================== + Hits 16937 16941 +4 Misses 2269 2269 Partials 6 6
☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.
🚀 New features to boost your workflow:
- ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
- 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
bigbigDreamer
commented
Nov 17, 2025
I also have an idea to improve compatibility by using the CSS max() function together with env(safe-area-inset-*). The SafeArea component could expose a configurable fallback value (for example via a CSS variable), and then use max(env(safe-area-inset-bottom), var(--nutui-safe-area-fallback-bottom)) so that on Android browsers which support env() but return 0, we still get a reasonable, non‐zero safe-area inset from the fallback. @xiaoyatong
@supports(padding: max(0px)) {
padding-bottom: max(40px, env(safe-area-inset-left));
}
Uh oh!
There was an error while loading. Please reload this page.
🤔 这个变动的性质是?
🔗 相关 Issue
💡 需求背景和解决方案
- Use the legacy
image 2. Update the SafeArea component to forward `className` and `style` to its root element, allowing external customization (for example, adding extra spacing or custom background styles for specific devices/browsers).constant(safe-area-inset-*) functionas a fallback beforeenv(safe-area-inset-*)so that the SafeArea component works correctly on older iOS versions that only supportconstant().☑️ 请求合并前的自查清单
Summary by CodeRabbit