@momo-kits/native-kits 0.169.12-beta.3-debug → 0.169.12-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.
- package/compose/build.gradle.kts +1 -1
- package/compose/compose.podspec +1 -1
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTabBar.kt +4 -12
- package/gradle.properties +1 -1
- package/ios/Navigation/BottomTab/BottomTabBar.swift +4 -14
- package/ios/native-kits.podspec +1 -1
- package/ios-demo/MoMoUIKitsDemo.podspec +1 -1
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/BottomTabDemo.swift +3 -16
- package/package.json +1 -1
package/compose/build.gradle.kts
CHANGED
package/compose/compose.podspec
CHANGED
|
@@ -246,11 +246,7 @@ internal fun ColumnScope.TabItemContent(
|
|
|
246
246
|
}
|
|
247
247
|
}
|
|
248
248
|
|
|
249
|
-
//
|
|
250
|
-
private const val BADGE_MAX_CHARS = 5
|
|
251
|
-
|
|
252
|
-
// Badge value shown on a tab: null hides it, "" is a dot, numbers cap at 99+ ("0" hides it, RN parity),
|
|
253
|
-
// text keeps its first 5 characters.
|
|
249
|
+
// Badge value shown on a tab: null hides it, "" is a dot, numbers cap at 99+ ("0" hides it, RN parity).
|
|
254
250
|
internal fun tabBadgeLabel(item: BottomTabItem): String? {
|
|
255
251
|
val label = item.badgeLabel ?: return if (item.showDot) "" else null
|
|
256
252
|
if (label.isEmpty()) return ""
|
|
@@ -259,7 +255,7 @@ internal fun tabBadgeLabel(item: BottomTabItem): String? {
|
|
|
259
255
|
if (value == 0L) return if (item.showDot) "" else null
|
|
260
256
|
return if (value > 99) "99+" else label
|
|
261
257
|
}
|
|
262
|
-
return
|
|
258
|
+
return label
|
|
263
259
|
}
|
|
264
260
|
|
|
265
261
|
// 24 icon; badges hang off it unclipped: dot at 16/-2, label badge at 12/-7 growing right, or
|
|
@@ -291,8 +287,6 @@ internal fun TabIcon(item: BottomTabItem, tint: androidx.compose.ui.graphics.Col
|
|
|
291
287
|
}
|
|
292
288
|
}
|
|
293
289
|
|
|
294
|
-
private val BADGE_BORDER = 1.dp
|
|
295
|
-
|
|
296
290
|
// Numbers use the error color, text the warning color (Figma Badge round numeric / text); the text keeps
|
|
297
291
|
// its design size so it fits the 16 height on the Duo displays too.
|
|
298
292
|
@Composable
|
|
@@ -303,11 +297,9 @@ private fun TabBadge(label: String, modifier: Modifier) {
|
|
|
303
297
|
modifier = modifier
|
|
304
298
|
.height(16.dp)
|
|
305
299
|
.widthIn(min = 16.dp, max = TabBarMetrics.badgeMaxWidth)
|
|
306
|
-
// the 1 ring is drawn under the label: Modifier.border would paint over the text
|
|
307
|
-
.background(colors.background.surface, CircleShape)
|
|
308
|
-
.padding(BADGE_BORDER)
|
|
309
300
|
.background(if (isNumber) colors.error.primary else colors.warning.primary, CircleShape)
|
|
310
|
-
.
|
|
301
|
+
.border(1.dp, colors.background.surface, CircleShape)
|
|
302
|
+
.padding(horizontal = Spacing.XS),
|
|
311
303
|
contentAlignment = Alignment.Center,
|
|
312
304
|
) {
|
|
313
305
|
ScaleSizeScope(1f) {
|
package/gradle.properties
CHANGED
|
@@ -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 } })
|