@momo-kits/native-kits 0.169.8-beta.1 → 0.169.8-beta.2

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.
@@ -14,6 +14,9 @@ public final class Navigation: ObservableObject {
14
14
  private weak var registry: DynamicScreenRegistry?
15
15
  /// What the footer (or navigation bar) takes from the window bottom; lifts snack bars.
16
16
  var bottomObstruction: CGFloat = 0
17
+ /// A tab that pads itself asks (via `floatingTabBarEdgeToEdge()`) to run edge to edge behind the floating
18
+ /// bar and the home indicator; the kit then stops reserving that space. Compose's `bottomTabEdgeToEdge`.
19
+ @Published var bottomTabEdgeToEdge = false
17
20
 
18
21
  init(
19
22
  id: Int = -1,
@@ -189,3 +192,25 @@ struct OptionsStackScreen: View {
189
192
  )
190
193
  }
191
194
  }
195
+
196
+ // MARK: - Edge-to-edge tab content
197
+
198
+ public extension View {
199
+ /// Compose's `floatingTabBarContentPadding()`: the content of a `BottomTab` tab runs edge to edge behind
200
+ /// the floating tab bar and the home indicator, and pads its own bottom (e.g. a full-screen native view
201
+ /// with its own safe area). No effect outside a tab.
202
+ func floatingTabBarEdgeToEdge() -> some View {
203
+ modifier(FloatingTabBarEdgeToEdge())
204
+ }
205
+ }
206
+
207
+ private struct FloatingTabBarEdgeToEdge: ViewModifier {
208
+ @OptionalEnvironmentObject private var navigation: Navigation?
209
+
210
+ func body(content: Content) -> some View {
211
+ content.onAppear {
212
+ guard let navigation, navigation.bottomTabIndex != -1, !navigation.bottomTabEdgeToEdge else { return }
213
+ navigation.bottomTabEdgeToEdge = true
214
+ }
215
+ }
216
+ }
@@ -161,6 +161,16 @@ public struct StackScreen<Content: View>: View {
161
161
  && inputSearchProps == nil && !headerTransparent && !fullScreenContent
162
162
  }
163
163
 
164
+ /// Bottom room for the tab's content: clear of the floating bar, unless the tab runs edge to edge
165
+ /// (`floatingTabBarEdgeToEdge()`), when it also covers the home indicator that BottomTab keeps clear of
166
+ /// (a negative inset extends the content past the tab's frame).
167
+ private var contentBottomInset: CGFloat {
168
+ guard let navigation, navigation.bottomTabIndex != -1, navigation.bottomTabEdgeToEdge else {
169
+ return duoTabBarInsets.overlay
170
+ }
171
+ return -layout.insets.bottom
172
+ }
173
+
164
174
  /// iPhone Duo: the header leaves with the content and slides back in on a reverse scroll
165
175
  /// (RN DuoQuickReturnHeader). The side bar is drawn apart from the header, so it stays put.
166
176
  private var useQuickReturn: Bool {
@@ -379,7 +389,7 @@ public struct StackScreen<Content: View>: View {
379
389
  scrollOffset: $scrollOffset,
380
390
  scrollToTopCallback: scrollToTopCallback,
381
391
  animatedSearchInset: animatedSearchInset,
382
- bottomInset: duoTabBarInsets.overlay,
392
+ bottomInset: contentBottomInset,
383
393
  snapDistance: searchSnapDistance,
384
394
  onScrollIdle: settleHeader,
385
395
  content: { animatedHeroBody(animatedHeader) }
@@ -412,7 +422,7 @@ public struct StackScreen<Content: View>: View {
412
422
  scrollOffset: $scrollOffset,
413
423
  scrollToTopCallback: scrollToTopCallback,
414
424
  animatedSearchInset: animatedSearchInset,
415
- bottomInset: duoTabBarInsets.overlay,
425
+ bottomInset: contentBottomInset,
416
426
  snapDistance: searchSnapDistance,
417
427
  onScrollIdle: settleHeader,
418
428
  content: { duoInsetContent }
@@ -433,7 +443,7 @@ public struct StackScreen<Content: View>: View {
433
443
  scrollOffset: $scrollOffset,
434
444
  scrollToTopCallback: scrollToTopCallback,
435
445
  topInset: layout.headerHeight - layout.insets.top,
436
- bottomInset: duoTabBarInsets.overlay,
446
+ bottomInset: contentBottomInset,
437
447
  snapDistance: searchSnapDistance,
438
448
  onScrollIdle: settleHeader,
439
449
  content: content
@@ -479,7 +489,7 @@ public struct StackScreen<Content: View>: View {
479
489
  scrollOffset: $scrollOffset,
480
490
  scrollToTopCallback: scrollToTopCallback,
481
491
  animatedSearchInset: animatedSearchInset,
482
- bottomInset: duoTabBarInsets.overlay,
492
+ bottomInset: contentBottomInset,
483
493
  snapDistance: searchSnapDistance,
484
494
  onScrollIdle: settleHeader,
485
495
  content: content
@@ -561,7 +571,8 @@ private struct StackScreenContent<Content: View>: View {
561
571
  /// Room for a header the content scrolls under (iPhone Duo glass header).
562
572
  var topInset: CGFloat = 0
563
573
  /// Room for the floating tab bar that overlays the content: scrolling content runs under it and
564
- /// ends clear of it, static content stays above it.
574
+ /// ends clear of it, static content stays above it. Negative for an edge-to-edge tab: the content
575
+ /// reaches that far past its frame.
565
576
  var bottomInset: CGFloat = 0
566
577
  /// Compose's animated-search snap: a scroll that comes to rest part way through this distance
567
578
  /// finishes the move, up or back down.
@@ -622,6 +633,8 @@ private struct StackScreenContent<Content: View>: View {
622
633
  }
623
634
  }
624
635
  .coordinateSpace(name: scrollSpace)
636
+ // an edge-to-edge tab's scroll reaches past its frame, under the home indicator
637
+ .padding(.bottom, min(bottomInset, 0))
625
638
  .modifier(ScrollRest(offset: scrollOffset, onRest: scrollDidRest))
626
639
  // Status-bar tap (MoMoStatusBarTap swizzle) scrolls to top and notifies the consumer.
627
640
  .onReceive(NotificationCenter.default.publisher(for: MoMoStatusBarTap.notificationName)) { _ in
@@ -1,6 +1,6 @@
1
1
  Pod::Spec.new do |s|
2
2
  s.name = 'MoMoUIKits'
3
- s.version = '0.169.8-beta.1'
3
+ s.version = '0.169.8-beta.2'
4
4
  s.summary = 'MoMoUIKits for iOS'
5
5
  s.homepage = 'https://momo.vn'
6
6
  s.license = { :type => 'MIT' }
@@ -1,6 +1,6 @@
1
1
  Pod::Spec.new do |s|
2
2
  s.name = 'MoMoUIKitsDemo'
3
- s.version = '0.169.8-beta.1'
3
+ s.version = '0.169.8-beta.2'
4
4
  s.summary = 'Demo browser for MoMoUIKits SwiftUI components'
5
5
  s.homepage = 'https://momo.vn'
6
6
  s.license = { :type => 'MIT' }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@momo-kits/native-kits",
3
- "version": "0.169.8-beta.1",
3
+ "version": "0.169.8-beta.2",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "publish:local": "bash publish.sh local"