@momo-kits/native-kits 0.168.1-beta.3 → 0.168.1-beta.30

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.
Files changed (40) hide show
  1. package/CLAUDE.md +14 -10
  2. package/README.md +2 -10
  3. package/ios/Application/ApplicationEnvironment.swift +7 -6
  4. package/ios/Application/DesignSystemKits.swift +163 -0
  5. package/ios/Application/DesignSystemKitsPayload.swift +68 -0
  6. package/ios/Badge/BadgeRibbon.swift +8 -1
  7. package/ios/Extensions/Color++.swift +2 -4
  8. package/ios/Input/Input.swift +13 -3
  9. package/ios/Input/InputPhoneNumber.swift +1 -3
  10. package/ios/Input/InputSearch.swift +1 -2
  11. package/ios/Input/InputTextArea.swift +5 -3
  12. package/ios/InputMoney/InputMoney.swift +6 -7
  13. package/ios/Layout/ScreenLayout.swift +65 -10
  14. package/ios/Navigation/BottomSheet.swift +152 -21
  15. package/ios/Navigation/BottomTab/BottomTab.swift +12 -18
  16. package/ios/Navigation/BottomTab/BottomTabBar.swift +255 -114
  17. package/ios/Navigation/BottomTab/CurvedContainer.swift +51 -47
  18. package/ios/Navigation/BottomTab/DuoBarCompression.swift +2 -3
  19. package/ios/Navigation/BottomTab/DuoTabBar.swift +63 -172
  20. package/ios/Navigation/BottomTab/TabBarMetrics.swift +88 -0
  21. package/ios/Navigation/Component/HeaderBackground.swift +22 -1
  22. package/ios/Navigation/Component/SnackBar.swift +4 -0
  23. package/ios/Navigation/ModalScreen.swift +7 -3
  24. package/ios/Navigation/StackScreen.swift +6 -8
  25. package/ios/Popup/PopupDisplay.swift +2 -2
  26. package/ios/Popup/PopupInput.swift +2 -2
  27. package/ios/Popup/PopupLayout.swift +15 -10
  28. package/ios/Popup/PopupNotify.swift +2 -2
  29. package/ios/Stepper/Stepper.swift +1 -2
  30. package/ios/Template/TrustBanner/TrustBanner.swift +4 -2
  31. package/ios/Typography/FontScale.swift +29 -15
  32. package/ios/Typography/Text.swift +86 -12
  33. package/ios/Typography/Typography.swift +2 -2
  34. package/ios/native-kits.podspec +1 -1
  35. package/ios-demo/MoMoUIKitsDemo.podspec +1 -1
  36. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/BottomTabDemo.swift +224 -59
  37. package/package.json +1 -1
  38. package/publish.sh +2 -7
  39. package/ios/Typography/FontScaleStore.swift +0 -58
  40. package/ios/Typography/KitDesignSystem.swift +0 -17
@@ -32,6 +32,9 @@ public struct ScreenLayout: Equatable {
32
32
  public let width: CGFloat
33
33
  public let height: CGFloat
34
34
  public let isIPhoneDuo: Bool
35
+ /// iPhone Duo folded or not, whatever the window size (its hinge, or the outer display's one-sided strip);
36
+ /// drives popups, modal and bottom sheet.
37
+ public let isDuoDevice: Bool
35
38
  public let insets: EdgeInsets
36
39
  public let insetLeft: CGFloat
37
40
  public let insetRight: CGFloat
@@ -68,8 +71,16 @@ enum DuoMetrics {
68
71
  // (x 550–643 of 669, clock digits centered on y 47); its reserved region is taller than the glyphs.
69
72
  static let innerStatusBarCenterY: CGFloat = 47
70
73
  static let innerStatusBarWidth: CGFloat = 120
71
- // Widest short side of any single-display iPhone.
72
- static let iPhoneMaxShortSide: CGFloat = 440
74
+ // Host app's iOS 26 tab bar on the inner display in portrait: a 62pt glass pill sized to its tabs,
75
+ // QR as a 62pt platter beside it, ≥ 20pt from the sides, 13pt into the home indicator inset.
76
+ static let floatingTabBarHeight: CGFloat = 62
77
+ static let floatingTabBarMargin: CGFloat = 20
78
+ static let floatingTabBarInsetOverlap: CGFloat = 13
79
+ // Width of a system alert on the inner display, in both orientations.
80
+ static let modalMaxWidth: CGFloat = 440
81
+ // Fits a PopupNotify with image, scrolled description and actions at the max width (RN
82
+ // Application/device.ts); taller content scrolls instead of filling the inner display.
83
+ static let modalMaxHeight: CGFloat = 640
73
84
  }
74
85
 
75
86
  enum HeaderMetrics {
@@ -104,15 +115,17 @@ extension ScreenLayout {
104
115
  size: CGSize,
105
116
  insets: EdgeInsets,
106
117
  reservedRegions: [CGRect] = ReservedRegions.current,
107
- isPhone: Bool = isPhoneIdiom
118
+ isPhone: Bool = isPhoneIdiom,
119
+ isFoldable: Bool = FoldableDevice.isFoldable(measuredIn: keyWindow)
108
120
  ) -> ScreenLayout {
109
121
  let width = size.width
110
122
  let height = size.height
123
+ let isDuoDevice = isPhone && isFoldable
111
124
  var (headerHeight, headerStatusBarHeight) = headerGeometry(topInset: insets.top, isPhone: isPhone)
112
125
  let isDuo = isPhone && isIPhoneDuoWindow(width: width, height: height, insets: insets)
113
126
  guard isDuo else {
114
127
  return ScreenLayout(
115
- width: width, height: height, isIPhoneDuo: false, insets: insets,
128
+ width: width, height: height, isIPhoneDuo: false, isDuoDevice: isDuoDevice, insets: insets,
116
129
  insetLeft: 0, insetRight: 0, contentWidth: width,
117
130
  headerHeight: headerHeight, headerStatusBarHeight: headerStatusBarHeight, sideBar: nil,
118
131
  statusBarClearance: nil
@@ -171,8 +184,10 @@ extension ScreenLayout {
171
184
  )
172
185
  }
173
186
 
187
+ // the outer display reports no hinge; its one-sided strip still gives it away
174
188
  return ScreenLayout(
175
- width: width, height: height, isIPhoneDuo: true, insets: insets,
189
+ width: width, height: height, isIPhoneDuo: true,
190
+ isDuoDevice: isDuoDevice || insets.leading != insets.trailing, insets: insets,
176
191
  insetLeft: insets.leading, insetRight: insets.trailing,
177
192
  contentWidth: width - insets.leading - insets.trailing,
178
193
  headerHeight: headerHeight, headerStatusBarHeight: headerStatusBarHeight, sideBar: sideBar,
@@ -249,15 +264,54 @@ extension ScreenLayout {
249
264
  public var duoTopInset: CGFloat {
250
265
  max(insets.top, height > width ? max(insets.leading, insets.trailing) * 2 : 0)
251
266
  }
267
+
268
+ /// Room for a dialog on iPhone Duo: inside the safe area, so clear of the side toolbar strip, and
269
+ /// capped so it stays a dialog on the inner display.
270
+ var duoModalMaxWidth: CGFloat {
271
+ min(width - insets.leading - insets.trailing - Spacing.XL * 2, DuoMetrics.modalMaxWidth)
272
+ }
273
+
274
+ var duoModalMaxHeight: CGFloat {
275
+ min(height - insets.top - insets.bottom - Spacing.XL * 2, DuoMetrics.modalMaxHeight)
276
+ }
252
277
  }
253
278
 
254
- /// Port of RN `device.ts` `isIPhoneDuo()`: UIScreen stays on the outer display, so this
255
- /// still matches when Split View narrows the window. Used by popups and overlays.
279
+ /// Snapshot for call sites without `\.screenLayout`; not reactive. `windowSize` is ignored,
280
+ /// kept for host call sites.
256
281
  public func isIPhoneDuoDevice(windowSize: CGSize? = nil) -> Bool {
257
282
  guard isPhoneIdiom else { return false }
258
- let screen = UIScreen.main.bounds.size
259
- let window = windowSize ?? keyWindow?.bounds.size ?? screen
260
- return max(min(screen.width, screen.height), min(window.width, window.height)) > DuoMetrics.iPhoneMaxShortSide
283
+ let insets = keyWindow?.safeAreaInsets
284
+ return FoldableDevice.isFoldable(measuredIn: keyWindow) || insets.map { $0.left != $0.right } == true
285
+ }
286
+
287
+ /// Apple's foldable check (as the host's `SideTabRailView.isFoldableDevice`): only a device with a
288
+ /// hinge reports a `.division` region, inactive while flat but still there. Screen size cannot tell
289
+ /// it apart from a large iPhone in landscape or a narrowed window.
290
+ enum FoldableDevice {
291
+ // a hinge never goes away, so a positive answer is kept
292
+ private static var isKnownFoldable = false
293
+
294
+ static func isFoldable(measuredIn view: UIView?) -> Bool {
295
+ if isKnownFoldable { return true }
296
+ // compiled out on SDKs older than iOS 27.1 (UIKit 9127.0.85.28)
297
+ #if canImport(UIKit, _version: 9127.0.85.28)
298
+ guard #available(iOS 27.1, *), let view, view.window != nil || view is UIWindow else { return false }
299
+ isKnownFoldable = !view.reservedRegions(kind: .division, options: .includeInactive).isEmpty
300
+ #endif
301
+ return isKnownFoldable
302
+ }
303
+
304
+ /// Catches the hinge when the regions were read too early (before the window had them).
305
+ static func observe(in view: UIView) {
306
+ #if canImport(UIKit, _version: 9127.0.85.28)
307
+ guard #available(iOS 27.1, *) else { return }
308
+ view.addInteraction(UIHingeInteraction { _, update in
309
+ guard update.hinge != nil, !isKnownFoldable else { return }
310
+ isKnownFoldable = true
311
+ NotificationCenter.default.post(name: ReservedRegions.didChange, object: nil)
312
+ })
313
+ #endif
314
+ }
261
315
  }
262
316
 
263
317
  // MARK: - Reserved regions
@@ -282,6 +336,7 @@ private final class ReservedRegionsProbe: UIView {
282
336
  override init(frame: CGRect) {
283
337
  super.init(frame: frame)
284
338
  isUserInteractionEnabled = false
339
+ FoldableDevice.observe(in: self)
285
340
  }
286
341
 
287
342
  required init?(coder: NSCoder) { nil }
@@ -15,16 +15,25 @@ import SwiftUI
15
15
 
16
16
  /// Mirrors Compose's `sealed class BottomHeader` (Title / Custom).
17
17
  public struct BottomSheetHeader {
18
+ struct Back {
19
+ let icon: String
20
+ let action: () -> Void
21
+ }
22
+
18
23
  enum Style {
19
- case title(String)
24
+ case title(String, back: Back?)
20
25
  case custom(() -> AnyView)
21
26
  }
22
27
 
23
28
  let style: Style
24
29
 
25
- /// Mirrors `BottomHeader.Title`.
26
- public static func title(_ text: String = "Bottom Sheet Title") -> BottomSheetHeader {
27
- BottomSheetHeader(style: .title(text))
30
+ /// Mirrors `BottomHeader.Title`. `onBack` shows a back button; the sheet closes, then it runs.
31
+ public static func title(
32
+ _ text: String = "Bottom Sheet Title",
33
+ backIcon: String = "arrow-back",
34
+ onBack: (() -> Void)? = nil
35
+ ) -> BottomSheetHeader {
36
+ BottomSheetHeader(style: .title(text, back: onBack.map { Back(icon: backIcon, action: $0) }))
28
37
  }
29
38
 
30
39
  /// Mirrors `BottomHeader.Custom`.
@@ -68,6 +77,9 @@ struct BottomSheetView<Content: View>: View {
68
77
  /// Mirrors Compose's `sheetCloseOffset` (100dp drag threshold to dismiss).
69
78
  private let closeThreshold: CGFloat = 100
70
79
 
80
+ private let indicatorHeight: CGFloat = 16
81
+ private let headerRowHeight: CGFloat = 56
82
+
71
83
  /// Mirrors Compose's per-term peak (0.3f). Combined with `backgroundAlpha` the
72
84
  /// steady-state (fully open) scrim peaks at 0.6, matching ModalScreen's peak.
73
85
  private let maxDynamicAlpha: CGFloat = 0.3
@@ -77,7 +89,23 @@ struct BottomSheetView<Content: View>: View {
77
89
 
78
90
  private var isDuo: Bool { layout.isDuoDevice }
79
91
  // iPhone Duo inner display: center the sheet instead of spanning the width
80
- private var isDuoCentered: Bool { isDuo && layout.width >= 600 }
92
+ // short side, as RN: the outer display stays floating in landscape (678pt wide) too
93
+ private var isDuoCentered: Bool { isDuo && min(layout.width, layout.height) >= 600 }
94
+ /// Outer display: the sheet floats Spacing.M off the side edges like system sheets, its content
95
+ /// stays in the safe area and its buttons move to the side bar column (HIG).
96
+ private var isDuoFloating: Bool { isDuo && !isDuoCentered }
97
+
98
+ private var titleBack: BottomSheetHeader.Back? {
99
+ if case .title(_, let back) = header.style { return back }
100
+ return nil
101
+ }
102
+
103
+ private var sideColumn: SideBarLayout? {
104
+ guard isDuoFloating, case .title = header.style, let sideBar = layout.sideBar,
105
+ sideBar.width - Spacing.M >= DuoMetrics.controlSize + Spacing.M
106
+ else { return nil }
107
+ return sideBar
108
+ }
81
109
 
82
110
  /// Keeps the portrait width in landscape, like system sheets.
83
111
  private var duoCenteredWidth: CGFloat {
@@ -87,18 +115,20 @@ struct BottomSheetView<Content: View>: View {
87
115
  )
88
116
  }
89
117
 
90
- /// Landscape side buttons span the full height, so the content is inset; in portrait the
91
- /// side status bar only covers the top corner.
118
+ /// The floating sheet spans the side safe area, its content stays clear of it.
92
119
  private var sideInsetLeading: CGFloat {
93
- isDuo && !isDuoCentered && layout.width > layout.height ? layout.insets.leading : 0
120
+ isDuoFloating ? max(layout.insets.leading - Spacing.M, 0) : 0
94
121
  }
95
122
 
96
123
  private var sideInsetTrailing: CGFloat {
97
- isDuo && !isDuoCentered && layout.width > layout.height ? layout.insets.trailing : 0
124
+ isDuoFloating ? max(layout.insets.trailing - Spacing.M, 0) : 0
98
125
  }
99
126
 
100
127
  private var maxHeight: CGFloat {
101
- isDuo ? layout.height - max(layout.duoTopInset, Spacing.XL) : screenHeight - 90
128
+ guard isDuo else { return screenHeight - 90 }
129
+ // stays below the side status bar: unlike RN (StatusBar.pushStackEntry) nothing restyles it, so a light
130
+ // clock over the sheet would vanish
131
+ return layout.height - max(layout.duoTopInset, Spacing.XL)
102
132
  }
103
133
  private var bottomInset: CGFloat { useBottomInset ? safeAreaBottomInset() : 0 }
104
134
  /// While the keyboard is up, it already covers the home-indicator area, so it
@@ -169,20 +199,23 @@ struct BottomSheetView<Content: View>: View {
169
199
  .fill(Colors.black06)
170
200
  .frame(width: 40, height: 4)
171
201
  Spacer().frame(height: 4)
202
+ // the handle centers on the whole sheet, only the header row keeps clear of the strip
172
203
  headerView
173
- .frame(height: 56)
204
+ .frame(height: headerRowHeight)
174
205
  .padding(.horizontal, Spacing.M)
175
206
  .padding(.leading, sideInsetLeading)
176
207
  .padding(.trailing, sideInsetTrailing)
177
208
  }
178
209
  .frame(maxWidth: .infinity)
179
- .frame(height: 72)
210
+ .frame(height: indicatorHeight + headerRowHeight)
180
211
  .contentShape(Rectangle())
181
212
  .gesture(dragGesture, including: draggable ? .all : .subviews)
182
213
 
183
214
  Rectangle()
184
215
  .fill(theme.colors.border.default)
185
216
  .frame(height: 1)
217
+ .padding(.leading, sideInsetLeading)
218
+ .padding(.trailing, sideInsetTrailing)
186
219
 
187
220
  content()
188
221
  .padding(.leading, sideInsetLeading)
@@ -191,7 +224,7 @@ struct BottomSheetView<Content: View>: View {
191
224
  .layoutPriority(-1)
192
225
 
193
226
  if let footer {
194
- BottomSheetFooter(content: footer)
227
+ BottomSheetFooter(content: footer, leadingInset: sideInsetLeading, trailingInset: sideInsetTrailing)
195
228
  }
196
229
  }
197
230
  // The filler stays outside the cap, which shrinks by it instead: the sheet still ends at
@@ -209,27 +242,61 @@ struct BottomSheetView<Content: View>: View {
209
242
  }
210
243
  )
211
244
  .background(backgroundColor)
212
- .clipShape(RoundedCorner(radius: Radius.M, corners: [.topLeft, .topRight]))
245
+ .overlay {
246
+ if let sideColumn {
247
+ BottomSheetSideColumn(
248
+ sideBar: sideColumn,
249
+ windowHeight: layout.height,
250
+ topOffset: indicatorHeight + (headerRowHeight - DuoMetrics.controlSize) / 2,
251
+ back: titleBack,
252
+ onBack: goBack,
253
+ onClose: { close() }
254
+ )
255
+ }
256
+ }
257
+ .clipShape(RoundedCorner(radius: isDuo ? Radius.XL : Radius.M, corners: [.topLeft, .topRight]))
258
+ .padding(.horizontal, isDuoFloating ? Spacing.M : 0)
213
259
  }
214
260
 
215
261
  @ViewBuilder
216
262
  private var headerView: some View {
217
263
  switch header.style {
218
- case .title(let text):
264
+ case .title(let text, let back):
265
+ // the side column holds back and close, the row keeps only the title
266
+ let showsButtons = sideColumn == nil
219
267
  HStack(spacing: 0) {
220
- Color.clear.frame(width: 24, height: 24)
268
+ if showsButtons {
269
+ if let back {
270
+ headerButton(icon: back.icon, accessibilityId: "btn_bottom_sheet_back") { goBack(back) }
271
+ } else {
272
+ Color.clear.frame(width: 24, height: 24)
273
+ }
274
+ }
221
275
  MomoText(text, typography: .headerDefaultBold, color: Colors.black17)
222
276
  .frame(maxWidth: .infinity, alignment: .center)
223
- Icon(source: "navigation_close", size: 24, color: Colors.black17)
224
- .frame(width: 24, height: 24)
225
- .contentShape(Rectangle())
226
- .onTapGesture { close() }
277
+ .padding(.horizontal, showsButtons ? 0 : Spacing.M)
278
+ if showsButtons {
279
+ headerButton(icon: "navigation_close", accessibilityId: "btn_bottom_sheet_close") { close() }
280
+ }
227
281
  }
228
282
  case .custom(let builder):
229
283
  builder()
230
284
  }
231
285
  }
232
286
 
287
+ private func headerButton(icon: String, accessibilityId: String, action: @escaping () -> Void) -> some View {
288
+ Icon(source: icon, size: 24, color: Colors.black17)
289
+ .frame(width: 24, height: 24)
290
+ .contentShape(Rectangle())
291
+ .onTapGesture(perform: action)
292
+ .accessibilityIdentifier(accessibilityId)
293
+ }
294
+
295
+ /// RN `leftOptions.onPressIconLeft`: the sheet closes first, then the back runs.
296
+ private func goBack(_ back: BottomSheetHeader.Back) {
297
+ close(then: back.action)
298
+ }
299
+
233
300
  // MARK: - Drag handling (mirrors Compose's detectDragGestures)
234
301
 
235
302
  private var dragGesture: some Gesture {
@@ -282,7 +349,7 @@ struct BottomSheetView<Content: View>: View {
282
349
 
283
350
  /// Mirrors Compose's `closeEvent`: slide out over 200ms, then fade the scrim
284
351
  /// out over 100ms only after the slide finishes, then dismiss.
285
- private func close() {
352
+ private func close(then onClosed: (() -> Void)? = nil) {
286
353
  guard !isClosing else { return }
287
354
  isClosing = true
288
355
  withAnimation(.timingCurve(0.3, 0, 0.8, 0.15, duration: 0.2)) {
@@ -294,7 +361,67 @@ struct BottomSheetView<Content: View>: View {
294
361
  }
295
362
  }
296
363
  DispatchQueue.main.asyncAfter(deadline: .now() + 0.3) {
364
+ // a newer overlay replaced this one: it stays, and this sheet's back is dropped
365
+ guard navigator.overplay?.id == overplayId else { return }
297
366
  navigator.finishOverplayDismiss(id: overplayId)
367
+ onClosed?()
368
+ }
369
+ }
370
+ }
371
+
372
+ /// iPhone Duo outer display: back and close sit on the part of the sheet under the side safe area,
373
+ /// 12pt from the strip's inner edge like the screen side bar. They follow the header row while the
374
+ /// sheet is short and stay below the status bar cluster while it is tall.
375
+ private struct BottomSheetSideColumn: View {
376
+ let sideBar: SideBarLayout
377
+ let windowHeight: CGFloat
378
+ /// Lines the controls up with the header row.
379
+ let topOffset: CGFloat
380
+ let back: BottomSheetHeader.Back?
381
+ let onBack: (BottomSheetHeader.Back) -> Void
382
+ let onClose: () -> Void
383
+
384
+ @Environment(\.appTheme) private var theme
385
+
386
+ private var isRight: Bool { sideBar.edge == .right }
387
+
388
+ private var columnHeight: CGFloat {
389
+ let count: CGFloat = back != nil ? 2 : 1
390
+ return count * DuoMetrics.controlSize + (count - 1) * Spacing.M
391
+ }
392
+
393
+ private var headerColor: HeaderColor {
394
+ getHeaderColor(isAnimated: false, isSurface: true, opacity: 1, tintColor: nil, defaultColor: theme.colors.text.default)
395
+ }
396
+
397
+ var body: some View {
398
+ GeometryReader { proxy in
399
+ let sheetHeight = proxy.size.height
400
+ // the sheet rests on the window bottom; its slide is an offset outside this layout
401
+ let sheetTop = windowHeight - sheetHeight
402
+ // clear of a camera at the bottom end of the strip when it can
403
+ let lowest = sheetHeight - sideBar.bottom - columnHeight
404
+ let top = max(min(max(sideBar.top - sheetTop, topOffset), lowest), 0)
405
+ VStack(alignment: isRight ? .leading : .trailing, spacing: Spacing.M) {
406
+ if let back {
407
+ SideBarButton(
408
+ icon: back.icon,
409
+ headerColor: headerColor,
410
+ accessibilityId: "btn_bottom_sheet_back",
411
+ action: { onBack(back) }
412
+ )
413
+ }
414
+ SideBarButton(
415
+ icon: "navigation_close",
416
+ headerColor: headerColor,
417
+ accessibilityId: "btn_bottom_sheet_close",
418
+ action: onClose
419
+ )
420
+ }
421
+ .padding(isRight ? .leading : .trailing, Spacing.M)
422
+ .frame(width: sideBar.width - Spacing.M, alignment: isRight ? .leading : .trailing)
423
+ .padding(.top, top)
424
+ .frame(maxWidth: .infinity, maxHeight: .infinity, alignment: isRight ? .topTrailing : .topLeading)
298
425
  }
299
426
  }
300
427
  }
@@ -371,12 +498,16 @@ private struct CapHeightLayout: Layout {
371
498
  /// Mirrors Compose's `BottomSheetFooter`: a surface band with a soft shadow cast on the content.
372
499
  private struct BottomSheetFooter: View {
373
500
  let content: () -> AnyView
501
+ var leadingInset: CGFloat = 0
502
+ var trailingInset: CGFloat = 0
374
503
 
375
504
  @Environment(\.appTheme) private var theme
376
505
 
377
506
  var body: some View {
378
507
  content()
379
508
  .frame(maxWidth: .infinity)
509
+ .padding(.leading, leadingInset)
510
+ .padding(.trailing, trailingInset)
380
511
  .padding(.vertical, Spacing.S)
381
512
  .background(theme.colors.background.surface)
382
513
  .overlay(alignment: .top) {
@@ -53,10 +53,9 @@ public struct BottomTab: View {
53
53
  }
54
54
 
55
55
  private var bottomInset: CGFloat { safeAreaBottomInset() }
56
- // the Duo bars overlay the content or sit in the side strip, so only the home indicator is kept clear
57
- private var reservedBottom: CGFloat {
58
- layout.isIPhoneDuo ? layout.insets.bottom : BOTTOM_TAB_BAR_HEIGHT + bottomInset + Spacing.S
59
- }
56
+ // the bars float over the content (tab screens keep clear of them through duoTabBarInsets) or sit
57
+ // in the side strip, so only the home indicator is kept clear
58
+ private var reservedBottom: CGFloat { layout.insets.bottom }
60
59
 
61
60
  private var compression: DuoBarCompression {
62
61
  DuoBarCompression.resolve(
@@ -104,18 +103,13 @@ public struct BottomTab: View {
104
103
  compression: compression
105
104
  )
106
105
  } else {
107
- // Tab bar + home-indicator filler.
108
- VStack(spacing: 0) {
109
- BottomTabBar(
110
- items: items,
111
- floatingButton: floatingButton,
112
- selectedIndex: selectedIndex,
113
- onTabSelected: selectTab
114
- )
115
- theme.colors.background.surface
116
- .frame(height: bottomInset + Spacing.S)
117
- .ignoresSafeArea(edges: .horizontal)
118
- }
106
+ BottomTabBar(
107
+ items: items,
108
+ floatingButton: floatingButton,
109
+ selectedIndex: selectedIndex,
110
+ onTabSelected: selectTab,
111
+ bottomInset: bottomInset
112
+ )
119
113
  }
120
114
  }
121
115
  .frame(maxWidth: .infinity, maxHeight: .infinity)
@@ -137,6 +131,7 @@ public struct BottomTab: View {
137
131
  }
138
132
 
139
133
  private func selectTab(_ index: Int) {
134
+ navigator.maxApi?.triggerEventVibration("light")
140
135
  let switchTab = { if index != selectedIndex { selectedIndex = index } }
141
136
  if let onTabPress { onTabPress(index, switchTab) } else { switchTab() }
142
137
  }
@@ -325,8 +320,7 @@ private struct TabCard: View {
325
320
 
326
321
  /// Bottom safe-area inset (home indicator).
327
322
  private func safeAreaBottomInset() -> CGFloat {
328
- let bottomInset = UIApplication.shared.connectedScenes
323
+ UIApplication.shared.connectedScenes
329
324
  .compactMap { ($0 as? UIWindowScene)?.keyWindow?.safeAreaInsets.bottom }
330
325
  .first ?? 0
331
- return min(bottomInset, 21)
332
326
  }