Skip to content

armgit / cindy

Public Imported from GitHub
0

Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。

fix(mobile): iOS 动作菜单无 Liquid Glass 时恢复系统分组底色

DavidShena5ccf5674a55
diff --git a/apps/mobile/docs/ios-native-components.md b/apps/mobile/docs/ios-native-components.md
index 2afe38978c..f1e064f307 100644
--- a/apps/mobile/docs/ios-native-components.md
+++ b/apps/mobile/docs/ios-native-components.md
@@ -26,7 +26,7 @@
| 任务详情面板 | 系统 BottomSheet、展开档位和拖拽关闭 | RN 内容、间距和业务信息布局;不能称整页系统 Form。[实现](../src/session/SessionDetailsNative.ios.tsx) |
| 附件、伙伴等面板 | 原生 sheet;部分页面用 Form / Section / 原生按钮 | 某些资源块通过 RNHostView 嵌入 RN 内容。[公共外壳](../src/session/ComposerSheet.ios.tsx)、[伙伴内容桥](../src/session/CompanionNativeContent.ios.tsx) |
| 消息输入器 | UITextView 编辑核心与选择/撤销,原生展开控制器 | Cindy 编写的原生引用/文档逻辑、业务工具栏;外框在可用系统上用原生 GlassView。[编辑器](../src/session/ComposerNativeInput.ios.tsx)、[外框](../src/session/ComposerFrame.ios.tsx) |
-| 底部动作菜单 | 自定义原生 UIViewController / UITableView + 系统 UISheetPresentationController;旧包回退系统 ActionSheetIOS | 不是每一种动作菜单都直接使用系统 UIAlertController。[模块](../modules/xdt-ios-action-sheet/ios/XdtIosActionSheetModule.swift) |
+| 底部动作菜单 | 自定义原生 UIViewController / UITableView + 系统 UISheetPresentationController;旧包回退系统 ActionSheetIOS | 不是每一种动作菜单都直接使用系统 UIAlertController;背景仅在 Liquid Glass 可用时透明,否则用系统分组底色。[模块](../modules/xdt-ios-action-sheet/ios/XdtIosActionSheetModule.swift) |
## 仍主要由 React Native 定制的部分
diff --git a/apps/mobile/modules/xdt-ios-action-sheet/ios/XdtIosActionSheetModule.swift b/apps/mobile/modules/xdt-ios-action-sheet/ios/XdtIosActionSheetModule.swift
index 59250283a0..bf5e8dcb53 100644
--- a/apps/mobile/modules/xdt-ios-action-sheet/ios/XdtIosActionSheetModule.swift
+++ b/apps/mobile/modules/xdt-ios-action-sheet/ios/XdtIosActionSheetModule.swift
@@ -135,6 +135,17 @@ private final class CindyBottomActionSheetController: UIViewController, UITableV
private let tableView = UITableView(frame: .zero, style: .insetGrouped)
private var picked = false
+ /// 与 CindyComposerMorphModule / expo-glass-effect 同口径:只有 iOS 26 SDK 编译、
+ /// iOS 26+ 运行且未声明兼容模式时,系统 Sheet 才带 Liquid Glass 材质。
+ private static let liquidGlassAvailable: Bool = {
+ #if compiler(>=6.2)
+ if #available(iOS 26.0, *) {
+ return (Bundle.main.infoDictionary?["UIDesignRequiresCompatibility"] as? Bool) != true
+ }
+ #endif
+ return false
+ }()
+
private var actionIndices: [Int] {
labels.indices.filter { $0 != cancelButtonIndex }
}
@@ -160,16 +171,18 @@ private final class CindyBottomActionSheetController: UIViewController, UITableV
override func viewDidLoad() {
super.viewDidLoad()
- // iOS 26 的系统 Sheet 自带 Liquid Glass。不透明 grouped 底会把材质盖掉。
+ // 有 Liquid Glass 时透明,不透明 grouped 底会把材质盖掉;没有材质时 Sheet 本身
+ // 不画底,透明会让下层正文与菜单文字叠印(#5645),必须用系统分组底色。
+ let sheetBackground: UIColor = Self.liquidGlassAvailable ? .clear : .systemGroupedBackground
view.isOpaque = false
- view.backgroundColor = .clear
+ view.backgroundColor = sheetBackground
presentationController?.delegate = self
tableView.translatesAutoresizingMaskIntoConstraints = false
tableView.delegate = self
tableView.dataSource = self
tableView.isScrollEnabled = true
tableView.isOpaque = false
- tableView.backgroundColor = .clear
+ tableView.backgroundColor = sheetBackground
tableView.backgroundView = nil
tableView.separatorInset = UIEdgeInsets(top: 0, left: 16, bottom: 0, right: 16)
view.addSubview(tableView)
@@ -219,7 +232,9 @@ private final class CindyBottomActionSheetController: UIViewController, UITableV
}
cell.contentConfiguration = config
var background = UIBackgroundConfiguration.listGroupedCell()
- background.backgroundColor = .clear
+ if Self.liquidGlassAvailable {
+ background.backgroundColor = .clear
+ }
cell.backgroundConfiguration = background
cell.selectionStyle = .default
return cell