@ajuarezso/capacitor-liquid-glass 0.3.5 → 0.3.7
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.
|
@@ -114,19 +114,20 @@ final class LiquidGlassTabBarOverlay: UIViewController {
|
|
|
114
114
|
}
|
|
115
115
|
|
|
116
116
|
hostVC.addChild(self)
|
|
117
|
-
self.view.translatesAutoresizingMaskIntoConstraints = false
|
|
118
117
|
hostVC.view.addSubview(self.view)
|
|
118
|
+
self.view.translatesAutoresizingMaskIntoConstraints = false
|
|
119
|
+
// CRÍTICO: `didMove(toParent:)` ANTES de activar constraints. iOS 26
|
|
120
|
+
// ejecuta el primer layout pass al didMove; tener el parenting
|
|
121
|
+
// completo antes de que el sistema mida el UITabBar es lo que el
|
|
122
|
+
// heurístico de Liquid Glass auto-adopt espera (patrón stay-liquid).
|
|
123
|
+
self.didMove(toParent: hostVC)
|
|
119
124
|
// SIN top constraint — la altura del view se deriva del intrinsic
|
|
120
125
|
// content size del UITabBar dentro (~50pt + safe-area-bottom).
|
|
121
|
-
// Replica del patrón stay-liquid (validado en producción) que
|
|
122
|
-
// permite a iOS 26 detectar este UITabBar como "floating tab bar"
|
|
123
|
-
// y aplicarle Liquid Glass automáticamente.
|
|
124
126
|
NSLayoutConstraint.activate([
|
|
125
127
|
self.view.leadingAnchor.constraint(equalTo: hostVC.view.leadingAnchor),
|
|
126
128
|
self.view.trailingAnchor.constraint(equalTo: hostVC.view.trailingAnchor),
|
|
127
129
|
self.view.bottomAnchor.constraint(equalTo: hostVC.view.bottomAnchor),
|
|
128
130
|
])
|
|
129
|
-
self.didMove(toParent: hostVC)
|
|
130
131
|
self.hostVC = hostVC
|
|
131
132
|
emitLayout()
|
|
132
133
|
}
|
|
@@ -190,7 +191,12 @@ final class LiquidGlassTabBarOverlay: UIViewController {
|
|
|
190
191
|
return tab
|
|
191
192
|
}
|
|
192
193
|
|
|
193
|
-
tabBar.
|
|
194
|
+
// CRÍTICO: setter directo `tabBar.items = ...` en lugar de
|
|
195
|
+
// `tabBar.setItems(_, animated: false)`. En iOS 26 el método
|
|
196
|
+
// `setItems(animated:)` toma un path interno distinto que puede
|
|
197
|
+
// invalidar el adopt automático de Liquid Glass. El setter directo
|
|
198
|
+
// es el que stay-liquid usa (línea 98 de su TabsBarOverlay).
|
|
199
|
+
tabBar.items = uiItems
|
|
194
200
|
|
|
195
201
|
if selectedIndex < 0 {
|
|
196
202
|
tabBar.selectedItem = nil
|
|
@@ -200,7 +206,13 @@ final class LiquidGlassTabBarOverlay: UIViewController {
|
|
|
200
206
|
tabBar.selectedItem = uiItems[selectedIndex]
|
|
201
207
|
}
|
|
202
208
|
|
|
203
|
-
|
|
209
|
+
// tintColor SOLO se aplica para estilos override (`.ultraThin`,
|
|
210
|
+
// `.transparent`). En `.default` / `.liquidGlass` iOS 26 aplica su
|
|
211
|
+
// propio tint nativo automático como parte del material Liquid Glass.
|
|
212
|
+
// Sobreescribirlo con un color custom (incluso brand) rompe el balance
|
|
213
|
+
// del material y produce un look híbrido en vez del adopt puro.
|
|
214
|
+
if style == .ultraThin || style == .transparent,
|
|
215
|
+
let tintHex, let tint = UIColor(hex: tintHex) {
|
|
204
216
|
tabBar.tintColor = tint
|
|
205
217
|
}
|
|
206
218
|
emitLayout()
|
|
@@ -214,41 +226,23 @@ final class LiquidGlassTabBarOverlay: UIViewController {
|
|
|
214
226
|
tabBarItems[idx].badgeValue = value
|
|
215
227
|
}
|
|
216
228
|
|
|
229
|
+
/// CRÍTICO: NO tocar `tabBar.alpha`, `tabBar.transform` ni `tabBar.isHidden`.
|
|
230
|
+
/// iOS 26 inspecciona el UITabBar en el primer layout pass para decidir si
|
|
231
|
+
/// adopta Liquid Glass. Si en ese momento el bar está con `alpha=0` o un
|
|
232
|
+
/// `transform` distinto de `.identity`, el sistema descarta el adopt y NO
|
|
233
|
+
/// re-evalúa aunque después vuelva a valores normales.
|
|
234
|
+
///
|
|
235
|
+
/// Para animar la aparición/desaparición sin perder el adopt, se manipula
|
|
236
|
+
/// `self.view.isHidden` (el contenedor del VC), no el UITabBar mismo.
|
|
237
|
+
/// Patrón validado en stay-liquid (su `update()` simplemente hace
|
|
238
|
+
/// `view.isHidden = !visible`).
|
|
217
239
|
func show() {
|
|
218
|
-
|
|
219
|
-
tabBar.isHidden = false
|
|
220
|
-
tabBar.alpha = 0
|
|
221
|
-
tabBar.transform = CGAffineTransform(translationX: 0, y: 20)
|
|
222
|
-
UIView.animate(
|
|
223
|
-
withDuration: 0.28,
|
|
224
|
-
delay: 0,
|
|
225
|
-
usingSpringWithDamping: 0.85,
|
|
226
|
-
initialSpringVelocity: 0,
|
|
227
|
-
options: [.curveEaseOut, .allowUserInteraction],
|
|
228
|
-
animations: {
|
|
229
|
-
self.tabBar.alpha = 1
|
|
230
|
-
self.tabBar.transform = .identity
|
|
231
|
-
},
|
|
232
|
-
completion: nil
|
|
233
|
-
)
|
|
240
|
+
view.isHidden = false
|
|
234
241
|
emitLayout()
|
|
235
242
|
}
|
|
236
243
|
|
|
237
244
|
func hide() {
|
|
238
|
-
|
|
239
|
-
UIView.animate(
|
|
240
|
-
withDuration: 0.18,
|
|
241
|
-
delay: 0,
|
|
242
|
-
options: [.curveEaseIn, .allowUserInteraction],
|
|
243
|
-
animations: {
|
|
244
|
-
self.tabBar.alpha = 0
|
|
245
|
-
self.tabBar.transform = CGAffineTransform(translationX: 0, y: 20)
|
|
246
|
-
},
|
|
247
|
-
completion: { _ in
|
|
248
|
-
self.tabBar.isHidden = true
|
|
249
|
-
self.tabBar.transform = .identity
|
|
250
|
-
}
|
|
251
|
-
)
|
|
245
|
+
view.isHidden = true
|
|
252
246
|
}
|
|
253
247
|
|
|
254
248
|
func setSelectedIndex(_ index: Int) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ajuarezso/capacitor-liquid-glass",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.7",
|
|
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",
|