@momo-kits/native-kits 0.118.1-beta.1 → 0.118.1-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.
@@ -29,10 +29,10 @@ fun HeaderDefault(
29
29
  val height = statusBarHeight + HEADER_HEIGHT.dp
30
30
  Box(
31
31
  modifier = Modifier.fillMaxWidth().height(height)
32
- .background(backgroundColor ?: AppTheme.current.colors.background.surface)
32
+ .background(if(headerTransparent && backgroundColor != null) backgroundColor else AppTheme.current.colors.background.surface)
33
33
  .bottomBorder(
34
34
  strokeWidth = 1.dp,
35
- color = backgroundColor?: AppTheme.current.colors.border.default
35
+ color = if(headerTransparent && backgroundColor != null) backgroundColor else AppTheme.current.colors.border.default
36
36
  )
37
37
  ) {
38
38
  Box(
@@ -110,7 +110,8 @@ fun PopupNotify(
110
110
  image.ifNotNull(
111
111
  Image(
112
112
  source = image,
113
- modifier = Modifier.fillMaxWidth().aspectRatio(1.777f)
113
+ modifier = Modifier.fillMaxWidth().aspectRatio(1.777f),
114
+ options = Options(alignment = Alignment.Center)
114
115
  ), null
115
116
  )
116
117
 
@@ -42,7 +42,7 @@ fun PopupPromotion(
42
42
  indication = null,
43
43
  onClick = onPress
44
44
  ),
45
- options = Options(alignment = Alignment.Center, contentScale = ContentScale.Fit)
45
+ options = Options(alignment = Alignment.Center, contentScale = ContentScale.Crop)
46
46
  )
47
47
  }
48
48
  Box(
@@ -6,6 +6,7 @@ import SwiftUI
6
6
  public enum PopupButtonDirection {
7
7
  case row
8
8
  case column
9
+ case auto
9
10
  }
10
11
 
11
12
  // MARK: - PopupButtonType
@@ -37,7 +38,14 @@ public struct PopupDisplay: View {
37
38
 
38
39
  // MARK: Public
39
40
 
41
+ @State private var textHeight: CGFloat = .zero
42
+ @State private var isScrollable = false
43
+
40
44
  public var body: some View {
45
+ var shouldUseColumn: Bool {
46
+ buttonDirection == .column || (buttonDirection == .auto && (closeButtonTitle.count > 12 || actionButtonTitle.count > 12))
47
+ }
48
+
41
49
  VStack(spacing: 12) {
42
50
  ZStack(alignment: .topTrailing) {
43
51
  SwiftUI.Button(action: onClose) {
@@ -75,12 +83,37 @@ public struct PopupDisplay: View {
75
83
  .lineLimit(2)
76
84
  .accessibility(identifier: "title_popup_permission")
77
85
 
78
- Text(description)
79
- .foregroundColor(.black)
80
- .font(.paragraph)
81
- .opacity(0.6)
82
- .multilineTextAlignment(.leading)
83
- .padding(.bottom, 8)
86
+ Group {
87
+ if isScrollable {
88
+ ScrollView(showsIndicators: false) {
89
+ Text(description)
90
+ .font(.paragraph)
91
+ .foregroundColor(.black)
92
+ .opacity(0.6)
93
+ .multilineTextAlignment(.leading)
94
+ .background(GeometryReader { geo in
95
+ Color.clear
96
+ .onAppear {
97
+ textHeight = geo.size.height
98
+ }
99
+ })
100
+ }
101
+ .frame(height: 60)
102
+ } else {
103
+ Text(description)
104
+ .font(.paragraph)
105
+ .foregroundColor(.black)
106
+ .opacity(0.6)
107
+ .multilineTextAlignment(.leading)
108
+ .background(GeometryReader { geo in
109
+ Color.clear
110
+ .onAppear {
111
+ textHeight = geo.size.height
112
+ isScrollable = textHeight > 60 // adjust threshold to ~3 lines
113
+ }
114
+ })
115
+ }
116
+ }.padding(.bottom, 8)
84
117
 
85
118
  if(!errorCode.isEmpty) {
86
119
  Text(errorCode)
@@ -94,17 +127,17 @@ public struct PopupDisplay: View {
94
127
  .padding(.horizontal, 24)
95
128
  .padding(.bottom, 16)
96
129
 
97
- if buttonDirection == .row {
130
+ if shouldUseColumn {
98
131
  if buttonType == .text {
99
- RowTextButtons
132
+ ColumnTextButtons
100
133
  } else {
101
- RowButtons
134
+ ColumnButtons
102
135
  }
103
136
  } else {
104
137
  if buttonType == .text {
105
- ColumnTextButtons
138
+ RowTextButtons
106
139
  } else {
107
- ColumnButtons
140
+ RowButtons
108
141
  }
109
142
  }
110
143
 
@@ -27,8 +27,9 @@ public struct PopupPromotion: View {
27
27
  .frame(maxWidth: UIScreen.main.bounds.width - Spacing.XL * 2)
28
28
  .clipped()
29
29
  }
30
+ .scaledToFill()
30
31
  .aspectRatio(0.72, contentMode: .fit)
31
- .frame(maxWidth: UIScreen.main.bounds.width - Spacing.XL * 2)
32
+ .frame(maxWidth: UIScreen.main.bounds.width - Spacing.XL * 2, alignment: .center)
32
33
  .clipped()
33
34
  .onTapGesture {
34
35
  onAction?()
package/package.json CHANGED
@@ -1,8 +1,7 @@
1
1
  {
2
2
  "name": "@momo-kits/native-kits",
3
- "version": "0.118.1-beta.1",
3
+ "version": "0.118.1-beta.2",
4
4
  "private": false,
5
5
  "dependencies": {},
6
- "devDependencies": {},
7
6
  "license": "MoMo"
8
7
  }