@momo-kits/native-kits 0.162.49-debug → 0.162.50-debug

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.
@@ -57,6 +57,7 @@ struct SnackBarView: View {
57
57
  let bottomInset: CGFloat
58
58
 
59
59
  @EnvironmentObject private var navigator: Navigator
60
+ @Environment(\.screenLayout) private var layout
60
61
 
61
62
  @State private var contentHeight: CGFloat = 0
62
63
  @State private var offsetY: CGFloat = 0
@@ -75,6 +76,9 @@ struct SnackBarView: View {
75
76
  )
76
77
  .offset(y: offsetY)
77
78
  .padding(.bottom, bottomInset)
79
+ // iPhone Duo: clear of the side toolbar strip, like the screen content (0 elsewhere)
80
+ .padding(.leading, layout.insetLeft)
81
+ .padding(.trailing, layout.insetRight)
78
82
  }
79
83
  .frame(maxWidth: .infinity, maxHeight: .infinity)
80
84
  .ignoresSafeArea()
@@ -34,11 +34,15 @@ struct ModalScreen<Content: View>: View {
34
34
  }
35
35
 
36
36
  content()
37
+ // iPhone Duo: capped so it stays a dialog on the inner display; nil leaves the size alone
38
+ .frame(
39
+ maxWidth: layout.isDuoDevice ? layout.duoModalMaxWidth : nil,
40
+ maxHeight: layout.isDuoDevice ? layout.duoModalMaxHeight : nil
41
+ )
37
42
  .scaleEffect(contentScale)
38
43
  .opacity(contentOpacity)
39
- // iPhone Duo: center below the side status bar and above the home indicator
40
- .padding(.top, layout.isDuoDevice ? layout.duoTopInset : 0)
41
- .padding(.bottom, layout.isDuoDevice ? layout.insets.bottom : 0)
44
+ // iPhone Duo: center in the safe area, clear of the side toolbar strip and the home indicator
45
+ .padding(layout.isDuoDevice ? layout.insets : EdgeInsets())
42
46
  }
43
47
  // Full screen like RN's Modal, so asymmetric landscape insets don't shift the content sideways.
44
48
  .frame(maxWidth: .infinity, maxHeight: .infinity)
@@ -107,7 +107,7 @@ public struct PopupDisplay: View {
107
107
  }
108
108
  .fixedSize(horizontal: false, vertical: true)
109
109
  .background(theme.colors.background.surface)
110
- .clipShape(RoundedRectangle(cornerRadius: Radius.L))
110
+ .clipShape(RoundedRectangle(cornerRadius: layout.popupRadius()))
111
111
 
112
112
  if isShowCloseIcon {
113
113
  PopupCloseButton(action: onClose)
@@ -115,7 +115,7 @@ public struct PopupDisplay: View {
115
115
  }
116
116
  }
117
117
  .frame(maxWidth: layout.popupMaxWidth)
118
- .padding(.horizontal, 12)
118
+ .padding(.horizontal, layout.popupHorizontalPadding(12))
119
119
  .accessibilityElement(children: .contain)
120
120
  .accessibilityIdentifier("popup_notify")
121
121
  }
@@ -59,11 +59,11 @@ public struct PopupInput: View {
59
59
  .offset(x: 11, y: -11)
60
60
  }
61
61
  }
62
- .background(theme.colors.background.surface.cornerRadius(8))
62
+ .background(theme.colors.background.surface.cornerRadius(layout.popupRadius(8)))
63
63
  .shadow(color: .black.opacity(0.08), radius: 2, x: 0, y: 0)
64
64
  .shadow(color: .black.opacity(0.16), radius: 24, x: 0, y: 0)
65
65
  .frame(maxWidth: layout.popupMaxWidth)
66
- .padding(.horizontal, 40)
66
+ .padding(.horizontal, layout.popupHorizontalPadding(40))
67
67
  }
68
68
 
69
69
  // MARK: Internal
@@ -1,19 +1,26 @@
1
1
  import SDWebImageSwiftUI
2
2
  import SwiftUI
3
3
 
4
- // Width of a system alert on the iPhone Duo inner display, in both orientations (RN Popup/utils.ts).
5
- private let duoPopupMaxWidth: CGFloat = 440
6
-
7
4
  extension ScreenLayout {
8
- /// Card width cap (Compose `popupMaxWidth`); unbounded off iPhone Duo, where the popup's own padding sets the width.
5
+ /// Card width cap on iPhone Duo (the modal bounds, Compose `popupMaxWidth`); unbounded elsewhere,
6
+ /// where the popup's own padding sets the width.
9
7
  var popupMaxWidth: CGFloat {
10
- isDuoDevice ? duoPopupMaxWidth : .infinity
8
+ isDuoDevice ? duoModalMaxWidth : .infinity
9
+ }
10
+
11
+ /// The modal bounds already keep iPhone Duo popups off the edges, so their own side padding goes.
12
+ func popupHorizontalPadding(_ padding: CGFloat) -> CGFloat {
13
+ isDuoDevice ? 0 : padding
11
14
  }
12
15
 
13
- /// Room left for a popup on iPhone Duo, where landscape is too short for it; nil elsewhere.
16
+ /// Tallest a popup gets on iPhone Duo, landscape and the inner display included; nil elsewhere.
14
17
  var popupMaxHeight: CGFloat? {
15
- guard isDuoDevice else { return nil }
16
- return height - duoTopInset - insets.bottom - Spacing.XL * 2
18
+ isDuoDevice ? duoModalMaxHeight : nil
19
+ }
20
+
21
+ /// Rounder on iPhone Duo, closer to its system alerts.
22
+ func popupRadius(_ regular: CGFloat = Radius.L) -> CGFloat {
23
+ isDuoDevice ? Radius.XL : regular
17
24
  }
18
25
  }
19
26
 
@@ -105,7 +105,7 @@ public struct PopupNotify: View {
105
105
  .popupReadHeight($actionsHeight)
106
106
  }
107
107
  .background(theme.colors.background.surface)
108
- .clipShape(RoundedRectangle(cornerRadius: Radius.L))
108
+ .clipShape(RoundedRectangle(cornerRadius: layout.popupRadius()))
109
109
 
110
110
  if props.isShowCloseIcon {
111
111
  PopupCloseButton(action: props.onIconClose)
@@ -113,7 +113,7 @@ public struct PopupNotify: View {
113
113
  }
114
114
  }
115
115
  .frame(maxWidth: layout.popupMaxWidth)
116
- .padding(.horizontal, Spacing.M)
116
+ .padding(.horizontal, layout.popupHorizontalPadding(Spacing.M))
117
117
  .accessibilityElement(children: .contain)
118
118
  .accessibilityIdentifier("popup_notify")
119
119
  }
@@ -19,11 +19,19 @@ public struct FontScale: Equatable {
19
19
  public let useOSScaleRate: Bool
20
20
  /// OS Dynamic Type factor at the time the snapshot was taken.
21
21
  public let osFontScale: CGFloat
22
+ // AI-GENERATED START: device scale from the app window, not UIScreen.main (fixed to one display on iPhone Duo)
23
+ public let windowShortSide: CGFloat
22
24
 
23
- public init(userScaleRate: CGFloat = 1, useOSScaleRate: Bool = true, osFontScale: CGFloat = 1) {
25
+ public init(
26
+ userScaleRate: CGFloat = 1,
27
+ useOSScaleRate: Bool = true,
28
+ osFontScale: CGFloat = 1,
29
+ windowShortSide: CGFloat? = nil
30
+ ) {
24
31
  self.userScaleRate = userScaleRate
25
32
  self.useOSScaleRate = useOSScaleRate
26
33
  self.osFontScale = osFontScale
34
+ self.windowShortSide = windowShortSide ?? DesignSystemKits.currentWindowShortSide()
27
35
  }
28
36
 
29
37
  /// `callAsFunction` so call sites keep reading like Compose's `scaleSize(16)`.
@@ -31,8 +39,8 @@ public struct FontScale: Equatable {
31
39
  guard useOSScaleRate else { return size * userScaleRate }
32
40
 
33
41
  // Short side, not width: landscape must not inflate every font (and so every popup's height).
34
- let bounds = UIScreen.main.bounds.size
35
- let deviceScale = min(bounds.width, bounds.height) / Self.defaultScreenSize
42
+ let deviceScale = windowShortSide / Self.defaultScreenSize
43
+ // AI-GENERATED END: device scale from the app window, not UIScreen.main (fixed to one display on iPhone Duo)
36
44
 
37
45
  var deviceScaled = size
38
46
  var osScaled = size
@@ -58,7 +66,10 @@ public struct FontScale: Equatable {
58
66
  return FontScale(
59
67
  userScaleRate: userScaleRate ?? self.userScaleRate,
60
68
  useOSScaleRate: useOSScaleRate ?? self.useOSScaleRate,
61
- osFontScale: osFontScale
69
+ osFontScale: osFontScale,
70
+ // AI-GENERATED START: keep the window size through context overrides
71
+ windowShortSide: windowShortSide
72
+ // AI-GENERATED END: keep the window size through context overrides
62
73
  )
63
74
  }
64
75
  }
@@ -1,6 +1,6 @@
1
1
  Pod::Spec.new do |s|
2
2
  s.name = 'MoMoUIKits'
3
- s.version = '0.167.1-beta.22'
3
+ s.version = '0.168.1-beta.8'
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.167.1-beta.22'
3
+ s.version = '0.168.1-beta.8'
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.162.49-debug",
3
+ "version": "0.162.50-debug",
4
4
  "private": false,
5
5
  "dependeNavigationncies": {},
6
6
  "devDependencies": {},