@ajuarezso/capacitor-liquid-glass 0.3.3 → 0.3.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -63,20 +63,13 @@ final class LiquidGlassTabBarOverlay: UIViewController {
63
63
  private var items: [LiquidGlassTabItem] = []
64
64
  private weak var hostVC: UIViewController?
65
65
 
66
- /// Reemplaza `self.view` por una `PassThroughView` custom. El override
67
- /// de `hitTest` vive en la `UIView` (no en el `UIViewController`), así
68
- /// que necesitamos una subclase dedicada en lugar de override el VC.
69
- override func loadView() {
70
- let v = PassThroughView()
71
- v.allowedHitView = tabBar
72
- self.view = v
73
- }
74
-
75
66
  override func viewDidLoad() {
76
67
  super.viewDidLoad()
77
- // Background transparente solo el `UITabBar` (la pill flotante)
78
- // ocupa espacio visible. El resto del área es transparente y la
79
- // `PassThroughView` deja pasar los toques al webview por debajo.
68
+ // Background transparente. El `self.view` está sizado SOLO al rect
69
+ // del tab bar (leading/trailing/bottom al rootVC, sin top la
70
+ // altura la determina el intrinsic content size del UITabBar dentro).
71
+ // Por eso NO necesitamos `hitTest` override: el view en sí solo
72
+ // existe sobre el área de la pill, los taps fuera no llegan.
80
73
  view.backgroundColor = .clear
81
74
 
82
75
  tabBar.translatesAutoresizingMaskIntoConstraints = false
@@ -88,28 +81,16 @@ final class LiquidGlassTabBarOverlay: UIViewController {
88
81
 
89
82
  view.addSubview(tabBar)
90
83
 
84
+ // UITabBar ocupa TODO el self.view — el view es del tamaño exacto
85
+ // de la pill gracias a las constraints del attach() (sin top).
91
86
  NSLayoutConstraint.activate([
92
87
  tabBar.leadingAnchor.constraint(equalTo: view.leadingAnchor),
93
88
  tabBar.trailingAnchor.constraint(equalTo: view.trailingAnchor),
89
+ tabBar.topAnchor.constraint(equalTo: view.topAnchor),
94
90
  tabBar.bottomAnchor.constraint(equalTo: view.bottomAnchor),
95
91
  ])
96
92
  }
97
93
 
98
- /// View que cubre todo el rootVC pero solo absorbe taps que aterrizan
99
- /// sobre `allowedHitView` (el `UITabBar` floating). El resto pasa al
100
- /// webview de Capacitor por debajo. Sin esto, este overlay bloquearía
101
- /// TODO el contenido de la app.
102
- private final class PassThroughView: UIView {
103
- weak var allowedHitView: UIView?
104
-
105
- override func hitTest(_ point: CGPoint, with event: UIEvent?) -> UIView? {
106
- let hit = super.hitTest(point, with: event)
107
- guard let hit, let allowed = allowedHitView else { return nil }
108
- if hit === allowed || hit.isDescendant(of: allowed) { return hit }
109
- return nil
110
- }
111
- }
112
-
113
94
  /// Adjunta este view controller como child del rootViewController del
114
95
  /// window. Idempotente: si ya está adjuntado al mismo root, no-op.
115
96
  func attach(to window: UIWindow) {
@@ -126,10 +107,14 @@ final class LiquidGlassTabBarOverlay: UIViewController {
126
107
  rootVC.addChild(self)
127
108
  self.view.translatesAutoresizingMaskIntoConstraints = false
128
109
  rootVC.view.addSubview(self.view)
110
+ // SIN top constraint — la altura del view se deriva del intrinsic
111
+ // content size del UITabBar dentro (~50pt + safe-area-bottom).
112
+ // Replica del patrón stay-liquid (validado en producción) que
113
+ // permite a iOS 26 detectar este UITabBar como "floating tab bar"
114
+ // y aplicarle Liquid Glass automáticamente.
129
115
  NSLayoutConstraint.activate([
130
116
  self.view.leadingAnchor.constraint(equalTo: rootVC.view.leadingAnchor),
131
117
  self.view.trailingAnchor.constraint(equalTo: rootVC.view.trailingAnchor),
132
- self.view.topAnchor.constraint(equalTo: rootVC.view.topAnchor),
133
118
  self.view.bottomAnchor.constraint(equalTo: rootVC.view.bottomAnchor),
134
119
  ])
135
120
  self.didMove(toParent: rootVC)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ajuarezso/capacitor-liquid-glass",
3
- "version": "0.3.3",
3
+ "version": "0.3.4",
4
4
  "description": "iOS 26 Liquid Glass native chrome (TabBar, NavigationBar, Alerts, Sheets) for Capacitor apps. Falls back gracefully on iOS < 26 and Android.",
5
5
  "main": "dist/plugin.cjs.js",
6
6
  "module": "dist/esm/index.js",