Skip to content

fix(tab-bar): fallback safe-area inset for HarmonyOS#4304

Open
Darley-Wey wants to merge 5 commits into
Tencent:developfrom
Darley-Wey:fix/tabbar-safe-area-fallback-4299
Open

fix(tab-bar): fallback safe-area inset for HarmonyOS#4304
Darley-Wey wants to merge 5 commits into
Tencent:developfrom
Darley-Wey:fix/tabbar-safe-area-fallback-4299

Conversation

@Darley-Wey

Copy link
Copy Markdown

Summary

  • Read bottom safe area from systemInfo and cache it as safeAreaBottomHeight in TabBar.
  • Inject --safe-area-inset-bottom in tab-bar.wxml, falling back to env(safe-area-inset-bottom) when value is 0.
  • Replace env(safe-area-inset-bottom) usage in tab-bar.less with var(--safe-area-inset-bottom).
  • Closes [TabBar] safe-area-inset-bottom在鸿蒙系统skyline环境无效 #4299.

Test plan

  • Build component dist and verify no compile errors.
  • Open TabBar examples in _example and verify layout on normal devices.
  • Verify HarmonyOS Skyline device/emulator applies bottom safe-area spacing correctly.

🤖 Generated with Claude Code

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>
Copilot AI review requested due to automatic review settings March 3, 2026 16:05

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 safeAreaBottomHeight in TabBar using systemInfo.safeArea.
  • Inject --safe-area-inset-bottom into the TabBar root inline style, with a fallback to env(safe-area-inset-bottom).
  • Update TabBar LESS to use var(--safe-area-inset-bottom) instead of env(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.

Comment thread packages/components/tab-bar/tab-bar.ts
Comment thread packages/components/tab-bar/tab-bar.wxml Outdated
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>
@pkg-pr-new

pkg-pr-new Bot commented Mar 4, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/tdesign-miniprogram@4304
npm i https://pkg.pr.new/@tdesign/uniapp@4304
npm i https://pkg.pr.new/@tdesign/uniapp-chat@4304

commit: 351982a

@tdesign-bot

tdesign-bot commented Mar 4, 2026

Copy link
Copy Markdown
Collaborator

TDesign Component Site Preview Open

Component Preview
tdesign-miniprogram 完成
@tdesign-miniprogram/chat 完成
tdesign-uniapp 完成
tdesign-uniapp-chat 完成

@anlyyao

anlyyao commented Jun 22, 2026

Copy link
Copy Markdown
Collaborator

@Darley-Wey 辛苦有空处理一下文件冲突~

@Darley-Wey

Copy link
Copy Markdown
Author

@Darley-Wey 辛苦有空处理一下文件冲突~

已合并最新版本

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[TabBar] safe-area-inset-bottom在鸿蒙系统skyline环境无效

5 participants