Просмотр исходного кода

enhance(ux): add opacity for iOS top bar buttons

Tienson Qin 3 месяцев назад
Родитель
Сommit
86dfde131a
2 измененных файлов с 19 добавлено и 5 удалено
  1. 1 4
      ios/App/App/LiquidTabsRootView.swift
  2. 18 1
      ios/App/App/NativeTopBarPlugin.swift

+ 1 - 4
ios/App/App/LiquidTabsRootView.swift

@@ -232,12 +232,9 @@ private struct LiquidTabs26View: View {
                     .foregroundColor: dimmed
                 ]
 
-                // Unselected icon color (90%)
-                appearance.stackedLayoutAppearance.normal.iconColor =
-                    UIColor.label.withAlphaComponent(0.9)
-
                 let tabBar = UITabBar.appearance()
                 tabBar.tintColor = .label
+                tabBar.unselectedItemTintColor = dimmed
                 tabBar.standardAppearance = appearance
                 tabBar.scrollEdgeAppearance = appearance
             }

+ 18 - 1
ios/App/App/NativeTopBarPlugin.swift

@@ -101,8 +101,19 @@ public class NativeTopBarPlugin: CAPPlugin, CAPBridgedPlugin {
                     button.titleLabel?.font = UIFont.systemFont(ofSize: 17, weight: .semibold)
                     button.addTarget(self, action: #selector(self.titleTapped(_:)), for: .touchUpInside)
                     topVC.navigationItem.titleView = button
+                    button.alpha = 0.8
                 } else {
-                    topVC.navigationItem.title = title
+                    let label = UILabel()
+                    label.text = title
+                    label.textAlignment = .center
+                    label.font = UIFont.systemFont(ofSize: 17, weight: .semibold)
+
+                    let baseColor = nav.navigationBar.tintColor
+                    label.textColor = baseColor?.withAlphaComponent(0.8)
+
+                    topVC.navigationItem.titleView = label
+                    topVC.navigationItem.title = nil
+
                 }
 
                 topVC.navigationItem.leftBarButtonItems = self.buildButtons(from: leftButtons)
@@ -141,6 +152,12 @@ public class NativeTopBarPlugin: CAPPlugin, CAPBridgedPlugin {
             container.addSubview(button)
 
             let item = UIBarButtonItem(customView: container)
+
+            // iOS 26+ Liquid Glass: remove the pill/glass background
+            if #available(iOS 26.0, *) {
+                button.alpha = 0.8
+            }
+
             return item
         }
     }