@momo-kits/native-kits 0.169.12-beta.3 → 0.169.12
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.
|
@@ -250,11 +250,7 @@ struct TabItemContent: View {
|
|
|
250
250
|
}
|
|
251
251
|
}
|
|
252
252
|
|
|
253
|
-
///
|
|
254
|
-
private let badgeMaxChars = 5
|
|
255
|
-
|
|
256
|
-
/// Badge value shown on a tab: nil hides it, "" is a dot, numbers cap at 99+ ("0" hides it, RN parity),
|
|
257
|
-
/// text keeps its first 5 characters.
|
|
253
|
+
/// Badge value shown on a tab: nil hides it, "" is a dot, numbers cap at 99+ ("0" hides it, RN parity).
|
|
258
254
|
func tabBadgeLabel(_ item: BottomTabItem) -> String? {
|
|
259
255
|
guard let label = item.badgeLabel else { return item.showDot ? "" : nil }
|
|
260
256
|
if label.isEmpty { return "" }
|
|
@@ -263,9 +259,7 @@ func tabBadgeLabel(_ item: BottomTabItem) -> String? {
|
|
|
263
259
|
if value == 0 { return item.showDot ? "" : nil }
|
|
264
260
|
return value > 99 ? "99+" : label
|
|
265
261
|
}
|
|
266
|
-
|
|
267
|
-
let head = String(label.prefix(badgeMaxChars))
|
|
268
|
-
return head.trimmingCharacters(in: .whitespaces) + "..."
|
|
262
|
+
return label
|
|
269
263
|
}
|
|
270
264
|
|
|
271
265
|
/// 24 icon, active and inactive tints cross-faded; badges hang off it: dot at 16/-2, label badge at
|
|
@@ -320,12 +314,8 @@ private struct TabBadge: View {
|
|
|
320
314
|
.scaleSizeMaxRate(1)
|
|
321
315
|
.padding(.horizontal, Spacing.XS)
|
|
322
316
|
.frame(minWidth: 16, maxWidth: TabBarMetrics.badgeMaxWidth, minHeight: 16, maxHeight: 16)
|
|
323
|
-
|
|
324
|
-
.background
|
|
325
|
-
Capsule()
|
|
326
|
-
.fill(isNumber ? theme.colors.error.primary : theme.colors.warning.primary)
|
|
327
|
-
.overlay(Capsule().strokeBorder(theme.colors.background.surface, lineWidth: 1))
|
|
328
|
-
)
|
|
317
|
+
.background(Capsule().fill(isNumber ? theme.colors.error.primary : theme.colors.warning.primary))
|
|
318
|
+
.overlay(Capsule().strokeBorder(theme.colors.background.surface, lineWidth: 1))
|
|
329
319
|
}
|
|
330
320
|
}
|
|
331
321
|
|
package/ios/native-kits.podspec
CHANGED
|
@@ -89,18 +89,7 @@ private func ctaLottie(_ animation: LottieAnimation?, offset: CGFloat) -> some V
|
|
|
89
89
|
}
|
|
90
90
|
private let badges: [(String, String?)] = [
|
|
91
91
|
("Không", nil), ("Dot \"\"", ""), ("\"0\"", "0"), ("\"5\"", "5"),
|
|
92
|
-
("\"1999\"", "1999"), ("\"Mới\"", "Mới"),
|
|
93
|
-
]
|
|
94
|
-
|
|
95
|
-
/// "Chữ dài" picks one of these at random on every tap.
|
|
96
|
-
private let longBadges = [
|
|
97
|
-
"Khuyến mãi lớn",
|
|
98
|
-
"Khám phá ngay",
|
|
99
|
-
"Ưu đãi cực sốc",
|
|
100
|
-
"Quà tặng hấp dẫn",
|
|
101
|
-
"Hoàn tiền mỗi ngày",
|
|
102
|
-
"Siêu sale cuối tuần",
|
|
103
|
-
"Thanh toán hóa đơn",
|
|
92
|
+
("\"1999\"", "1999"), ("\"Mới\"", "Mới"), ("Chữ dài", "Khuyến mãi lớn"),
|
|
104
93
|
]
|
|
105
94
|
|
|
106
95
|
struct BottomTabDemoContent: View {
|
|
@@ -186,12 +175,10 @@ private struct TabContent: View {
|
|
|
186
175
|
Section(title: "Tab đang mở · \(name)") {
|
|
187
176
|
IconOptions(title: "icon", icons: icons, value: tab.icon) { icon in updateTab { $0.icon = icon } }
|
|
188
177
|
Options(title: "badgeLabel",
|
|
189
|
-
hint: "\"\" là dot, \"0\" ẩn badge, số > 99 hiện 99+, chữ
|
|
178
|
+
hint: "\"\" là dot, \"0\" ẩn badge, số > 99 hiện 99+, chữ dài bị cắt ở 58",
|
|
190
179
|
options: badges.map { title, value in
|
|
191
180
|
Option(title: title, selected: tab.badgeLabel == value) { updateTab { $0.badgeLabel = value } }
|
|
192
|
-
}
|
|
193
|
-
updateTab { $0.badgeLabel = longBadges.randomElement() }
|
|
194
|
-
}])
|
|
181
|
+
})
|
|
195
182
|
Options(title: "showDot",
|
|
196
183
|
hint: "Hiện dot khi không có badgeLabel hoặc badgeLabel là \"0\"",
|
|
197
184
|
options: yesNo(tab.showDot) { value in updateTab { $0.showDot = value } })
|