fix(tab-bar): fallback safe-area inset for HarmonyOS#4304
Open
Darley-Wey wants to merge 5 commits into
Open
Conversation
Read window safe area and expose a css var fallback for env in TabBar. This keeps bottom inset working on HarmonyOS Skyline devices. Closes Tencent#4299. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR improves TabBar safe-area handling on HarmonyOS (Skyline) by computing a bottom inset from runtime system info, exposing it to styles via a CSS custom property, and routing existing safe-area CSS to use that custom property.
Changes:
- Compute and cache
safeAreaBottomHeightinTabBarusingsystemInfo.safeArea. - Inject
--safe-area-inset-bottominto the TabBar root inline style, with a fallback toenv(safe-area-inset-bottom). - Update TabBar LESS to use
var(--safe-area-inset-bottom)instead ofenv(safe-area-inset-bottom).
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| packages/components/tab-bar/tab-bar.wxml | Injects a CSS custom property for bottom safe-area inset with an env() fallback. |
| packages/components/tab-bar/tab-bar.ts | Adds safe-area bottom inset calculation and stores it in component data. |
| packages/components/tab-bar/tab-bar.less | Switches safe-area spacing usage to var(--safe-area-inset-bottom). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Move the injected --safe-area-inset-bottom style before style/customStyle so customStyle remains last in _._style and can still override values. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
commit: |
Collaborator
TDesign Component Site Preview Open
|
Collaborator
|
@Darley-Wey 辛苦有空处理一下文件冲突~ |
Author
已合并最新版本 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary
systemInfoand cache it assafeAreaBottomHeightin TabBar.--safe-area-inset-bottomintab-bar.wxml, falling back toenv(safe-area-inset-bottom)when value is 0.env(safe-area-inset-bottom)usage intab-bar.lesswithvar(--safe-area-inset-bottom).Test plan
_exampleand verify layout on normal devices.🤖 Generated with Claude Code