-
Notifications
You must be signed in to change notification settings - Fork 287
feat: enhance SafeArea with className/style props and constant() iOS fallback #3388
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: feat_v3.x
Are you sure you want to change the base?
feat: enhance SafeArea with className/style props and constant() iOS fallback #3388
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. 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. 🚀 New features to boost your workflow:
|
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 |

🤔 这个变动的性质是?
🔗 相关 Issue
💡 需求背景和解决方案
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