@onekeyfe/react-native-native-list 3.0.179-alpha.2026101502 → 3.0.179-alpha.302
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/LICENSE +36 -0
- package/README.md +32 -3
- package/android/build.gradle +0 -1
- package/android/src/main/java/com/onekey/nativelist/HybridNativeList.kt +22 -3
- package/android/src/main/java/com/onekey/nativelist/NativeListAccessoryStack.kt +8 -8
- package/android/src/main/java/com/onekey/nativelist/NativeListActionRenderer.kt +5 -5
- package/android/src/main/java/com/onekey/nativelist/NativeListActivityDetailsView.kt +4 -4
- package/android/src/main/java/com/onekey/nativelist/NativeListActivityRenderer.kt +6 -6
- package/android/src/main/java/com/onekey/nativelist/NativeListAdapter.kt +6 -1
- package/android/src/main/java/com/onekey/nativelist/NativeListDataRowRenderer.kt +11 -11
- package/android/src/main/java/com/onekey/nativelist/NativeListIdentityRenderer.kt +20 -20
- package/android/src/main/java/com/onekey/nativelist/NativeListLeadingVisual.kt +5 -4
- package/android/src/main/java/com/onekey/nativelist/NativeListMarketRenderer.kt +7 -7
- package/android/src/main/java/com/onekey/nativelist/NativeListMediaTileRenderer.kt +5 -5
- package/android/src/main/java/com/onekey/nativelist/NativeListMessageRenderer.kt +8 -7
- package/android/src/main/java/com/onekey/nativelist/NativeListMetricCardRenderer.kt +14 -14
- package/android/src/main/java/com/onekey/nativelist/NativeListPrimitives.kt +28 -15
- package/android/src/main/java/com/onekey/nativelist/NativeListRailRenderer.kt +4 -4
- package/android/src/main/java/com/onekey/nativelist/NativeListRendererRegistry.kt +3 -3
- package/android/src/main/java/com/onekey/nativelist/NativeListRendererRowView.kt +3 -2
- package/android/src/main/java/com/onekey/nativelist/NativeListResolvedText.kt +5 -4
- package/android/src/main/java/com/onekey/nativelist/NativeListRowHost.kt +1 -1
- package/android/src/main/java/com/onekey/nativelist/NativeListSectionHeaderRenderer.kt +20 -20
- package/android/src/main/java/com/onekey/nativelist/NativeListSystemRenderer.kt +3 -3
- package/android/src/main/java/com/onekey/nativelist/NativeListView.kt +104 -18
- package/android/src/main/java/com/onekey/nativelist/NativeListWalletGroupRenderer.kt +6 -5
- package/docs/SPEC.md +69 -19
- package/docs/STYLE_SPEC.md +12 -2
- package/ios/HybridNativeList.swift +15 -21
- package/ios/NativeListAccessoryStack.swift +14 -10
- package/ios/NativeListActionRenderer.swift +7 -4
- package/ios/NativeListActivityDetailsView.swift +63 -24
- package/ios/NativeListActivityRenderer.swift +19 -10
- package/ios/NativeListDataRowRenderer.swift +23 -19
- package/ios/NativeListDesignAssets.swift +43 -34
- package/ios/NativeListIdentityRenderer.swift +23 -19
- package/ios/NativeListLeadingVisual.swift +9 -4
- package/ios/NativeListMarketRenderer.swift +19 -11
- package/ios/NativeListMediaTileRenderer.swift +11 -7
- package/ios/NativeListMessageRenderer.swift +20 -10
- package/ios/NativeListMetricCardRenderer.swift +16 -12
- package/ios/NativeListRailRenderer.swift +9 -7
- package/ios/NativeListRendererCell.swift +6 -4
- package/ios/NativeListRendererRegistry.swift +8 -3
- package/ios/NativeListResolvedText.swift +3 -3
- package/ios/NativeListRowHost.swift +7 -2
- package/ios/NativeListSectionHeaderRenderer.swift +22 -19
- package/ios/NativeListSystemRenderer.swift +18 -16
- package/ios/NativeListTextStyles.swift +18 -12
- package/ios/NativeListWalletGroupRenderer.swift +6 -4
- package/ios/RNCNativeListView.swift +38 -92
- package/ios/tests/NativeListActivityPresentationTests.swift +5 -3
- package/ios/tests/NativeListLifecycleTests.swift +77 -2
- package/lib/module/NativeList.js +8 -24
- package/lib/module/NativeList.web.js +8 -3
- package/lib/module/fonts.js +44 -0
- package/lib/module/index.js +1 -0
- package/lib/module/web/NativeListWebEngine.js +48 -24
- package/lib/module/web/templates/ActionRowRenderer.js +2 -1
- package/lib/module/web/templates/IdentityRowRenderer.js +4 -3
- package/lib/module/web/templates/MarketRowRenderer.js +2 -1
- package/lib/module/web/templates/RowText.js +13 -3
- package/lib/module/web/templates/SectionHeaderRowRenderer.js +3 -2
- package/lib/nitrogen/generated/android/c++/JHybridNativeListSpec.cpp +9 -18
- package/lib/nitrogen/generated/android/c++/JHybridNativeListSpec.hpp +2 -4
- package/lib/nitrogen/generated/android/c++/views/JHybridNativeListStateUpdater.cpp +5 -10
- package/lib/nitrogen/generated/android/kotlin/com/margelo/nitro/nativelist/HybridNativeListSpec.kt +2 -8
- package/lib/nitrogen/generated/ios/c++/HybridNativeListSpecSwift.hpp +7 -12
- package/lib/nitrogen/generated/ios/c++/views/HybridNativeListComponent.mm +6 -12
- package/lib/nitrogen/generated/ios/swift/HybridNativeListSpec.swift +1 -2
- package/lib/nitrogen/generated/ios/swift/HybridNativeListSpec_cxx.swift +6 -17
- package/lib/nitrogen/generated/shared/c++/HybridNativeListSpec.cpp +2 -4
- package/lib/nitrogen/generated/shared/c++/HybridNativeListSpec.hpp +2 -4
- package/lib/nitrogen/generated/shared/c++/views/HybridNativeListComponent.cpp +2 -4
- package/lib/nitrogen/generated/shared/c++/views/HybridNativeListComponent.hpp +3 -6
- package/lib/nitrogen/generated/shared/json/NativeListConfig.json +1 -2
- package/lib/typescript/src/NativeList.nitro.d.ts +1 -2
- package/lib/typescript/src/NativeList.types.d.ts +0 -4
- package/lib/typescript/src/fonts.d.ts +10 -0
- package/lib/typescript/src/index.d.ts +2 -0
- package/lib/typescript/src/web/NativeListWebEngine.d.ts +4 -1
- package/lib/typescript/src/web/templates/RowText.d.ts +1 -0
- package/nitrogen/generated/android/c++/JHybridNativeListSpec.cpp +9 -18
- package/nitrogen/generated/android/c++/JHybridNativeListSpec.hpp +2 -4
- package/nitrogen/generated/android/c++/views/JHybridNativeListStateUpdater.cpp +5 -10
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nativelist/HybridNativeListSpec.kt +2 -8
- package/nitrogen/generated/ios/c++/HybridNativeListSpecSwift.hpp +7 -12
- package/nitrogen/generated/ios/c++/views/HybridNativeListComponent.mm +6 -12
- package/nitrogen/generated/ios/swift/HybridNativeListSpec.swift +1 -2
- package/nitrogen/generated/ios/swift/HybridNativeListSpec_cxx.swift +6 -17
- package/nitrogen/generated/shared/c++/HybridNativeListSpec.cpp +2 -4
- package/nitrogen/generated/shared/c++/HybridNativeListSpec.hpp +2 -4
- package/nitrogen/generated/shared/c++/views/HybridNativeListComponent.cpp +2 -4
- package/nitrogen/generated/shared/c++/views/HybridNativeListComponent.hpp +3 -6
- package/nitrogen/generated/shared/json/NativeListConfig.json +1 -2
- package/package.json +4 -5
- package/react-native-native-list.podspec +0 -1
- package/src/NativeList.nitro.ts +1 -2
- package/src/NativeList.tsx +4 -25
- package/src/NativeList.types.ts +0 -4
- package/src/NativeList.web.tsx +10 -3
- package/src/fonts.ts +64 -0
- package/src/index.ts +3 -0
- package/src/web/NativeListWebEngine.ts +53 -24
- package/src/web/templates/ActionRowRenderer.ts +2 -1
- package/src/web/templates/IdentityRowRenderer.ts +4 -3
- package/src/web/templates/MarketRowRenderer.ts +4 -2
- package/src/web/templates/RowText.ts +15 -3
- package/src/web/templates/SectionHeaderRowRenderer.ts +6 -3
- package/common/fonts/Roobert-Bold.ttf +0 -0
- package/common/fonts/Roobert-Medium.ttf +0 -0
- package/common/fonts/Roobert-Regular.ttf +0 -0
- package/common/fonts/Roobert-SemiBold.ttf +0 -0
|
@@ -94,7 +94,8 @@ final class NativeListSectionHeaderCell: NativeListRendererCell {
|
|
|
94
94
|
!["summary", "gallery"].contains(item.data.string("variant"))
|
|
95
95
|
}
|
|
96
96
|
override class func measure(
|
|
97
|
-
_ item: NativeListItem, width: CGFloat, theme: [String: Any]?, layout: String
|
|
97
|
+
_ item: NativeListItem, width: CGFloat, theme: [String: Any]?, layout: String,
|
|
98
|
+
fonts: NativeListFontFamilies
|
|
98
99
|
) -> CGFloat? {
|
|
99
100
|
if layout == "table" { return 28 }
|
|
100
101
|
if item.data.string("presentation") == "networkSelector" { return 47 }
|
|
@@ -210,7 +211,7 @@ final class NativeListSectionHeaderCell: NativeListRendererCell {
|
|
|
210
211
|
label.rowVerticalAlignment = nil
|
|
211
212
|
}
|
|
212
213
|
titleLabel.setContentHuggingPriority(.defaultLow, for: .horizontal)
|
|
213
|
-
subtitleLabel.font = nativeListFont(ofSize: 14)
|
|
214
|
+
subtitleLabel.font = nativeListFont(ofSize: 14, fonts: fonts)
|
|
214
215
|
subtitleLabel.textColor = nativeListColor(theme, "secondaryText", "#646464")
|
|
215
216
|
mainStack.alignment = .fill
|
|
216
217
|
mainStack.spacing = 2
|
|
@@ -221,7 +222,7 @@ final class NativeListSectionHeaderCell: NativeListRendererCell {
|
|
|
221
222
|
let value = accessoryButtons[0]
|
|
222
223
|
value.setTitle(nil, for: .normal)
|
|
223
224
|
value.setAttributedTitle(nil, for: .normal)
|
|
224
|
-
value.titleLabel?.font = nativeListFont(ofSize: 16, weight: .medium)
|
|
225
|
+
value.titleLabel?.font = nativeListFont(ofSize: 16, weight: .medium, fonts: fonts)
|
|
225
226
|
value.titleLabel?.numberOfLines = 1
|
|
226
227
|
value.titleLabel?.lineBreakMode = .byTruncatingTail
|
|
227
228
|
value.contentHorizontalAlignment = .center
|
|
@@ -275,13 +276,13 @@ final class NativeListSectionHeaderCell: NativeListRendererCell {
|
|
|
275
276
|
private func applyTextStyle(_ item: NativeListItem) {
|
|
276
277
|
let style = item.data.dictionary("style") ?? [:]
|
|
277
278
|
if let title = style.dictionary("title") {
|
|
278
|
-
NativeListTextStyles.applyStyledText(titleLabel, title)
|
|
279
|
+
NativeListTextStyles.applyStyledText(titleLabel, title, fonts: fonts)
|
|
279
280
|
}
|
|
280
281
|
if let subtitle = style.dictionary("subtitle") {
|
|
281
|
-
NativeListTextStyles.applyStyledText(subtitleLabel, subtitle)
|
|
282
|
+
NativeListTextStyles.applyStyledText(subtitleLabel, subtitle, fonts: fonts)
|
|
282
283
|
}
|
|
283
284
|
if let value = style.dictionary("value") {
|
|
284
|
-
NativeListTextStyles.applyStyledButton(accessoryButtons[0], value)
|
|
285
|
+
NativeListTextStyles.applyStyledButton(accessoryButtons[0], value, fonts: fonts)
|
|
285
286
|
}
|
|
286
287
|
}
|
|
287
288
|
override func bindSelectionContent(
|
|
@@ -305,8 +306,8 @@ final class NativeListSectionHeaderCell: NativeListRendererCell {
|
|
|
305
306
|
_ checkboxState: (NativeListItem, NativeSelectionTarget?, String) -> String
|
|
306
307
|
) {
|
|
307
308
|
checkboxControl.bind(
|
|
308
|
-
item, descriptors: [descriptor], theme: currentTheme, style: [:], checkboxState: checkboxState
|
|
309
|
-
|
|
309
|
+
item, descriptors: [descriptor], theme: currentTheme, style: [:], checkboxState: checkboxState,
|
|
310
|
+
fonts: fonts)
|
|
310
311
|
}
|
|
311
312
|
override func recycleContent() {
|
|
312
313
|
checkboxControl.reset()
|
|
@@ -382,8 +383,8 @@ final class NativeListSectionHeaderCell: NativeListRendererCell {
|
|
|
382
383
|
: isGallery || layout == "sectioned" ? .semibold : .regular
|
|
383
384
|
titleLabel.font = nativeListFont(
|
|
384
385
|
ofSize: isGallery ? 18 : isSummary ? 16 : isTable ? 11 : isHistory ? 12 : 14,
|
|
385
|
-
weight: isHistory ? .semibold : headerWeight
|
|
386
|
-
|
|
386
|
+
weight: isHistory ? .semibold : headerWeight,
|
|
387
|
+
fonts: fonts)
|
|
387
388
|
titleLabel.textColor = nativeListColor(
|
|
388
389
|
theme,
|
|
389
390
|
isSummary || isGallery ? "primaryText" : "secondaryText",
|
|
@@ -421,7 +422,7 @@ final class NativeListSectionHeaderCell: NativeListRendererCell {
|
|
|
421
422
|
if layout == "linear" {
|
|
422
423
|
// TokenManager's section title is a plain body label with mt=10,
|
|
423
424
|
// unlike the reusable 36-point SectionHeader used by sectioned lists.
|
|
424
|
-
titleLabel.font = nativeListFont(ofSize: 14)
|
|
425
|
+
titleLabel.font = nativeListFont(ofSize: 14, fonts: fonts)
|
|
425
426
|
topInset = 10
|
|
426
427
|
bottomInset = 0
|
|
427
428
|
}
|
|
@@ -482,11 +483,12 @@ final class NativeListSectionHeaderCell: NativeListRendererCell {
|
|
|
482
483
|
color: nativeListColor(theme, "secondaryText", "#646464")
|
|
483
484
|
)
|
|
484
485
|
accessoryButtons[0].titleLabel?.font = nativeListFont(
|
|
485
|
-
ofSize: 16, weight: isExplicitNetworkHeader ? .medium : .regular)
|
|
486
|
+
ofSize: 16, weight: isExplicitNetworkHeader ? .medium : .regular, fonts: fonts)
|
|
486
487
|
setButtonLine(
|
|
487
488
|
accessoryButtons[0],
|
|
488
489
|
text: item.data.string("value"),
|
|
489
|
-
font: nativeListFont(
|
|
490
|
+
font: nativeListFont(
|
|
491
|
+
ofSize: 16, weight: isExplicitNetworkHeader ? .medium : .regular, fonts: fonts),
|
|
490
492
|
color: nativeListColor(theme, "secondaryText", "#646464"),
|
|
491
493
|
lineHeight: 24
|
|
492
494
|
)
|
|
@@ -497,7 +499,7 @@ final class NativeListSectionHeaderCell: NativeListRendererCell {
|
|
|
497
499
|
trailingStack.axis = .horizontal
|
|
498
500
|
trailingStack.alignment = .center
|
|
499
501
|
trailingStack.spacing = 4
|
|
500
|
-
accessoryButtons[0].titleLabel?.font = nativeListFont(ofSize: 11)
|
|
502
|
+
accessoryButtons[0].titleLabel?.font = nativeListFont(ofSize: 11, fonts: fonts)
|
|
501
503
|
accessoryButtons[0].setTitleColor(
|
|
502
504
|
nativeListColor(theme, "secondaryText", "#646464"),
|
|
503
505
|
for: .normal
|
|
@@ -535,12 +537,12 @@ final class NativeListSectionHeaderCell: NativeListRendererCell {
|
|
|
535
537
|
bottomInset = -8
|
|
536
538
|
accessoryButtons[0].titleLabel?.font = nativeListTabularFont(
|
|
537
539
|
ofSize: 16,
|
|
538
|
-
weight: .medium
|
|
539
|
-
|
|
540
|
+
weight: .medium,
|
|
541
|
+
fonts: fonts)
|
|
540
542
|
setButtonLine(
|
|
541
543
|
accessoryButtons[0],
|
|
542
544
|
text: item.data.string("value"),
|
|
543
|
-
font: nativeListTabularFont(ofSize: 16, weight: .medium),
|
|
545
|
+
font: nativeListTabularFont(ofSize: 16, weight: .medium, fonts: fonts),
|
|
544
546
|
color: nativeListColor(theme, "primaryText", "#202020"),
|
|
545
547
|
lineHeight: 24
|
|
546
548
|
)
|
|
@@ -641,7 +643,7 @@ final class NativeListSectionHeaderCell: NativeListRendererCell {
|
|
|
641
643
|
}
|
|
642
644
|
for segment in segments {
|
|
643
645
|
attributes[.font] = nativeListTabularFont(
|
|
644
|
-
ofSize: segment.string("style") == "subscript" ? 10 : 16, weight: .medium)
|
|
646
|
+
ofSize: segment.string("style") == "subscript" ? 10 : 16, weight: .medium, fonts: fonts)
|
|
645
647
|
value.append(NSAttributedString(string: segment.string("text"), attributes: attributes))
|
|
646
648
|
}
|
|
647
649
|
button.setAttributedTitle(value, for: .normal)
|
|
@@ -679,7 +681,8 @@ final class NativeListSectionHeaderCell: NativeListRendererCell {
|
|
|
679
681
|
setButtonLine(
|
|
680
682
|
valueButton,
|
|
681
683
|
text: value,
|
|
682
|
-
font: nativeListFont(
|
|
684
|
+
font: nativeListFont(
|
|
685
|
+
ofSize: 16, weight: isExplicitNetworkHeader ? .medium : .regular, fonts: fonts),
|
|
683
686
|
color: nativeListColor(currentTheme, "secondaryText", "#646464"),
|
|
684
687
|
lineHeight: 24
|
|
685
688
|
)
|
|
@@ -2,9 +2,10 @@ import UIKit
|
|
|
2
2
|
|
|
3
3
|
final class NativeListSystemCell: NativeListRendererCell {
|
|
4
4
|
override class func measure(
|
|
5
|
-
_ item: NativeListItem, width: CGFloat, theme: [String: Any]?, layout: String
|
|
5
|
+
_ item: NativeListItem, width: CGFloat, theme: [String: Any]?, layout: String,
|
|
6
|
+
fonts: NativeListFontFamilies
|
|
6
7
|
) -> CGFloat? {
|
|
7
|
-
return NativeListSystemRenderer.measure(item, width: width)
|
|
8
|
+
return NativeListSystemRenderer.measure(item, width: width, fonts: fonts)
|
|
8
9
|
}
|
|
9
10
|
override class func appliesSizePreset(_ item: NativeListItem) -> Bool {
|
|
10
11
|
NativeListSystemRenderer.appliesSizePreset(item)
|
|
@@ -75,7 +76,8 @@ final class NativeListSystemCell: NativeListRendererCell {
|
|
|
75
76
|
label.text = nil
|
|
76
77
|
label.isHidden = true
|
|
77
78
|
label.font = nativeListFont(
|
|
78
|
-
ofSize: label === titleLabel ? 16 : 14, weight: label === titleLabel ? .medium : .regular
|
|
79
|
+
ofSize: label === titleLabel ? 16 : 14, weight: label === titleLabel ? .medium : .regular,
|
|
80
|
+
fonts: fonts)
|
|
79
81
|
label.textColor = nativeListColor(
|
|
80
82
|
theme, label === titleLabel ? "primaryText" : "secondaryText",
|
|
81
83
|
label === titleLabel ? "#202020" : "#646464")
|
|
@@ -90,7 +92,7 @@ final class NativeListSystemCell: NativeListRendererCell {
|
|
|
90
92
|
button.setAttributedTitle(nil, for: .normal)
|
|
91
93
|
button.setTitle(nil, for: .normal)
|
|
92
94
|
button.isHidden = true
|
|
93
|
-
button.titleLabel?.font = nativeListFont(ofSize: 16, weight: .medium)
|
|
95
|
+
button.titleLabel?.font = nativeListFont(ofSize: 16, weight: .medium, fonts: fonts)
|
|
94
96
|
button.titleLabel?.numberOfLines = 1
|
|
95
97
|
button.contentEdgeInsets = .zero
|
|
96
98
|
button.contentHorizontalAlignment = .center
|
|
@@ -116,13 +118,13 @@ final class NativeListSystemCell: NativeListRendererCell {
|
|
|
116
118
|
if style["trailingGap"] != nil { trailingStack.spacing = CGFloat(style.double("trailingGap")) }
|
|
117
119
|
let warning = item.data.string("variant") == "warning"
|
|
118
120
|
if warning, let text = style.dictionary("title") {
|
|
119
|
-
NativeListTextStyles.applyStyledText(titleLabel, text)
|
|
121
|
+
NativeListTextStyles.applyStyledText(titleLabel, text, fonts: fonts)
|
|
120
122
|
}
|
|
121
123
|
if let text = style.dictionary("message") {
|
|
122
|
-
NativeListTextStyles.applyStyledText(warning ? subtitleLabel : titleLabel, text)
|
|
124
|
+
NativeListTextStyles.applyStyledText(warning ? subtitleLabel : titleLabel, text, fonts: fonts)
|
|
123
125
|
}
|
|
124
126
|
if let text = style.dictionary("actionText") {
|
|
125
|
-
NativeListTextStyles.applyStyledButton(button, text)
|
|
127
|
+
NativeListTextStyles.applyStyledButton(button, text, fonts: fonts)
|
|
126
128
|
}
|
|
127
129
|
contentInsets = UIEdgeInsets(
|
|
128
130
|
top: topInset, left: leftInset, bottom: -bottomInset, right: -rightInset)
|
|
@@ -229,7 +231,7 @@ final class NativeListSystemCell: NativeListRendererCell {
|
|
|
229
231
|
bottomInset = -(height - top - (message.isEmpty ? 30 : 61))
|
|
230
232
|
if !message.isEmpty {
|
|
231
233
|
show(titleLabel, message, lines: 2)
|
|
232
|
-
titleLabel.font = nativeListTabularFont(ofSize: 16)
|
|
234
|
+
titleLabel.font = nativeListTabularFont(ofSize: 16, fonts: fonts)
|
|
233
235
|
titleLabel.textColor = nativeListColor(theme, "secondaryText", "#646464")
|
|
234
236
|
titleLabel.textAlignment = .center
|
|
235
237
|
setLineHeight(titleLabel, text: message, lineHeight: 24)
|
|
@@ -240,7 +242,7 @@ final class NativeListSystemCell: NativeListRendererCell {
|
|
|
240
242
|
button.backgroundColor = .clear
|
|
241
243
|
button.layer.cornerRadius = 15
|
|
242
244
|
setButtonLine(
|
|
243
|
-
button, text: text, font: nativeListTabularFont(ofSize: 14, weight: .medium),
|
|
245
|
+
button, text: text, font: nativeListTabularFont(ofSize: 14, weight: .medium, fonts: fonts),
|
|
244
246
|
color: nativeListColor(theme, "secondaryText", "#646464"), lineHeight: 20)
|
|
245
247
|
let textWidth = button.intrinsicContentSize.width
|
|
246
248
|
selectorConstraints.append(contentsOf: [
|
|
@@ -284,7 +286,7 @@ final class NativeListSystemCell: NativeListRendererCell {
|
|
|
284
286
|
root.addArrangedSubview(mainStack)
|
|
285
287
|
mainStack.alignment = .center
|
|
286
288
|
mainStack.setContentHuggingPriority(.defaultLow, for: .horizontal)
|
|
287
|
-
titleLabel.font = nativeListTabularFont(ofSize: 16)
|
|
289
|
+
titleLabel.font = nativeListTabularFont(ofSize: 16, fonts: fonts)
|
|
288
290
|
titleLabel.textColor = nativeListColor(theme, "secondaryText", "#646464")
|
|
289
291
|
titleLabel.textAlignment = .center
|
|
290
292
|
show(titleLabel, item.data.string("message"), lines: 1)
|
|
@@ -324,9 +326,9 @@ final class NativeListSystemCell: NativeListRendererCell {
|
|
|
324
326
|
topInset = 14
|
|
325
327
|
bottomInset = -14
|
|
326
328
|
mainStack.spacing = 4
|
|
327
|
-
titleLabel.font = nativeListFont(ofSize: 14, weight: .medium)
|
|
329
|
+
titleLabel.font = nativeListFont(ofSize: 14, weight: .medium, fonts: fonts)
|
|
328
330
|
titleLabel.numberOfLines = 0
|
|
329
|
-
subtitleLabel.font = nativeListFont(ofSize: 14)
|
|
331
|
+
subtitleLabel.font = nativeListFont(ofSize: 14, fonts: fonts)
|
|
330
332
|
subtitleLabel.numberOfLines = 0
|
|
331
333
|
show(titleLabel, item.data.string("title"), lines: 0)
|
|
332
334
|
show(subtitleLabel, item.data.string("message"), lines: 0)
|
|
@@ -375,7 +377,7 @@ final class NativeListSystemCell: NativeListRendererCell {
|
|
|
375
377
|
mainStack.alignment = variant == "loading" || alignsToStart ? .leading : .center
|
|
376
378
|
if alignsToStart {
|
|
377
379
|
mainStack.setContentHuggingPriority(.defaultLow, for: .horizontal)
|
|
378
|
-
titleLabel.font = nativeListFont(ofSize: 14)
|
|
380
|
+
titleLabel.font = nativeListFont(ofSize: 14, fonts: fonts)
|
|
379
381
|
titleLabel.textColor = nativeListColor(theme, "secondaryText", "#646464")
|
|
380
382
|
setLineHeight(titleLabel, text: titleLabel.text ?? "", lineHeight: 20)
|
|
381
383
|
}
|
|
@@ -388,7 +390,7 @@ final class NativeListSystemCell: NativeListRendererCell {
|
|
|
388
390
|
setButtonLine(
|
|
389
391
|
accessoryButtons[0],
|
|
390
392
|
text: "Retry",
|
|
391
|
-
font: nativeListFont(ofSize: 14, weight: .medium),
|
|
393
|
+
font: nativeListFont(ofSize: 14, weight: .medium, fonts: fonts),
|
|
392
394
|
color: nativeListColor(theme, "primaryText", "#202020"),
|
|
393
395
|
lineHeight: 20
|
|
394
396
|
)
|
|
@@ -512,7 +514,7 @@ enum NativeListSystemRenderer {
|
|
|
512
514
|
static func appliesSizePreset(_ item: NativeListItem) -> Bool {
|
|
513
515
|
!["warning", "spacer"].contains(item.data.string("variant"))
|
|
514
516
|
}
|
|
515
|
-
static func measure(_ item: NativeListItem, width: CGFloat) -> CGFloat {
|
|
517
|
+
static func measure(_ item: NativeListItem, width: CGFloat, fonts: NativeListFontFamilies) -> CGFloat {
|
|
516
518
|
if item.type == "system", item.data.string("variant") == "spacer" {
|
|
517
519
|
return CGFloat(item.data.int("height"))
|
|
518
520
|
}
|
|
@@ -536,7 +538,7 @@ enum NativeListSystemRenderer {
|
|
|
536
538
|
.font: nativeListFont(
|
|
537
539
|
ofSize: fontSize,
|
|
538
540
|
weight: NativeListTextStyles.marketFontWeight(
|
|
539
|
-
textStyle?.string("fontWeight") ?? "", fallback: weight)),
|
|
541
|
+
textStyle?.string("fontWeight") ?? "", fallback: weight), fonts: fonts),
|
|
540
542
|
.paragraphStyle: paragraph,
|
|
541
543
|
], context: nil
|
|
542
544
|
).height / lineHeight)
|
|
@@ -3,21 +3,23 @@ import UIKit
|
|
|
3
3
|
|
|
4
4
|
// Apply semantic overrides after a renderer has restored its resolved defaults.
|
|
5
5
|
enum NativeListTextStyles {
|
|
6
|
-
static func applyStyledText(
|
|
6
|
+
static func applyStyledText(
|
|
7
|
+
_ label: UILabel, _ style: [String: Any], fonts: NativeListFontFamilies
|
|
8
|
+
) {
|
|
7
9
|
let text = label.attributedText?.string ?? label.text ?? ""
|
|
8
10
|
guard !text.isEmpty, !style.isEmpty else { return }
|
|
9
11
|
let originalText = label.attributedText
|
|
10
12
|
let textLabel = label as? NativeListTextLabel
|
|
11
13
|
let baseFont =
|
|
12
14
|
(originalText?.attribute(.font, at: 0, effectiveRange: nil) as? UIFont) ?? label.font
|
|
13
|
-
?? nativeListFont(ofSize: 14)
|
|
15
|
+
?? nativeListFont(ofSize: 14, fonts: fonts)
|
|
14
16
|
let size = CGFloat(style.double("fontSize", default: Double(baseFont.pointSize)))
|
|
15
17
|
let font: UIFont
|
|
16
18
|
if let weightName = style["fontWeight"] as? String {
|
|
17
19
|
font = nativeListFont(
|
|
18
20
|
ofSize: size,
|
|
19
|
-
weight: marketFontWeight(weightName, fallback: .regular)
|
|
20
|
-
|
|
21
|
+
weight: marketFontWeight(weightName, fallback: .regular),
|
|
22
|
+
fonts: fonts)
|
|
21
23
|
} else {
|
|
22
24
|
font = baseFont.withSize(size)
|
|
23
25
|
}
|
|
@@ -53,7 +55,7 @@ enum NativeListTextStyles {
|
|
|
53
55
|
paragraph.lineBreakMode = label.lineBreakMode
|
|
54
56
|
}
|
|
55
57
|
var attributes: [NSAttributedString.Key: Any] = [:]
|
|
56
|
-
applyStyledFont(attributed, style, fallback: baseFont)
|
|
58
|
+
applyStyledFont(attributed, style, fallback: baseFont, fonts: fonts)
|
|
57
59
|
if style["color"] != nil { attributes[.foregroundColor] = color }
|
|
58
60
|
if style["alignment"] != nil || style["lines"] != nil || style["truncate"] != nil
|
|
59
61
|
|| style["lineHeight"] != nil
|
|
@@ -74,7 +76,9 @@ enum NativeListTextStyles {
|
|
|
74
76
|
label.attributedText = attributed
|
|
75
77
|
}
|
|
76
78
|
|
|
77
|
-
static func applyStyledButton(
|
|
79
|
+
static func applyStyledButton(
|
|
80
|
+
_ button: UIButton, _ style: [String: Any], fonts: NativeListFontFamilies
|
|
81
|
+
) {
|
|
78
82
|
let text =
|
|
79
83
|
button.attributedTitle(for: .normal)?.string
|
|
80
84
|
?? button.title(for: .normal)
|
|
@@ -84,14 +88,14 @@ enum NativeListTextStyles {
|
|
|
84
88
|
let accessory = button as? NativeListAccessoryButton
|
|
85
89
|
let baseFont =
|
|
86
90
|
(originalText?.attribute(.font, at: 0, effectiveRange: nil) as? UIFont) ?? button.titleLabel?
|
|
87
|
-
.font ?? nativeListFont(ofSize: 14)
|
|
91
|
+
.font ?? nativeListFont(ofSize: 14, fonts: fonts)
|
|
88
92
|
let size = CGFloat(style.double("fontSize", default: Double(baseFont.pointSize)))
|
|
89
93
|
let font: UIFont
|
|
90
94
|
if let weightName = style["fontWeight"] as? String {
|
|
91
95
|
font = nativeListFont(
|
|
92
96
|
ofSize: size,
|
|
93
|
-
weight: marketFontWeight(weightName, fallback: .regular)
|
|
94
|
-
|
|
97
|
+
weight: marketFontWeight(weightName, fallback: .regular),
|
|
98
|
+
fonts: fonts)
|
|
95
99
|
} else {
|
|
96
100
|
font = baseFont.withSize(size)
|
|
97
101
|
}
|
|
@@ -116,7 +120,7 @@ enum NativeListTextStyles {
|
|
|
116
120
|
: alignmentName == "end" ? .trailing : .center
|
|
117
121
|
}
|
|
118
122
|
var attributes: [NSAttributedString.Key: Any] = [:]
|
|
119
|
-
applyStyledFont(attributed, style, fallback: baseFont)
|
|
123
|
+
applyStyledFont(attributed, style, fallback: baseFont, fonts: fonts)
|
|
120
124
|
if style["color"] != nil { attributes[.foregroundColor] = color }
|
|
121
125
|
if style["alignment"] != nil || style["lineHeight"] != nil || style["lines"] != nil
|
|
122
126
|
|| style["truncate"] != nil
|
|
@@ -153,7 +157,8 @@ enum NativeListTextStyles {
|
|
|
153
157
|
}
|
|
154
158
|
|
|
155
159
|
static func applyStyledFont(
|
|
156
|
-
_ text: NSMutableAttributedString, _ style: [String: Any], fallback: UIFont
|
|
160
|
+
_ text: NSMutableAttributedString, _ style: [String: Any], fallback: UIFont,
|
|
161
|
+
fonts: NativeListFontFamilies
|
|
157
162
|
) {
|
|
158
163
|
guard style["fontSize"] != nil || style["fontWeight"] != nil else { return }
|
|
159
164
|
text.enumerateAttribute(.font, in: NSRange(location: 0, length: text.length)) {
|
|
@@ -164,7 +169,8 @@ enum NativeListTextStyles {
|
|
|
164
169
|
style["fontWeight"] == nil
|
|
165
170
|
? original.withSize(size)
|
|
166
171
|
: nativeListFont(
|
|
167
|
-
ofSize: size, weight: marketFontWeight(style.string("fontWeight"), fallback: .regular)
|
|
172
|
+
ofSize: size, weight: marketFontWeight(style.string("fontWeight"), fallback: .regular),
|
|
173
|
+
fonts: fonts)
|
|
168
174
|
text.addAttribute(.font, value: font, range: range)
|
|
169
175
|
}
|
|
170
176
|
}
|
|
@@ -55,7 +55,8 @@ final class NativeListWalletGroupCell: NativeListRendererCell, UIGestureRecogniz
|
|
|
55
55
|
}
|
|
56
56
|
override class func appliesSizePreset(_ item: NativeListItem) -> Bool { false }
|
|
57
57
|
override class func measure(
|
|
58
|
-
_ item: NativeListItem, width: CGFloat, theme: [String: Any]?, layout: String
|
|
58
|
+
_ item: NativeListItem, width: CGFloat, theme: [String: Any]?, layout: String,
|
|
59
|
+
fonts: NativeListFontFamilies
|
|
59
60
|
) -> CGFloat? {
|
|
60
61
|
let members = memberItems(item)
|
|
61
62
|
return members.reduce(
|
|
@@ -76,7 +77,7 @@ final class NativeListWalletGroupCell: NativeListRendererCell, UIGestureRecogniz
|
|
|
76
77
|
dragBadge.translatesAutoresizingMaskIntoConstraints = false
|
|
77
78
|
dragBadge.horizontalInset = 6
|
|
78
79
|
dragBadge.textAlignment = .center
|
|
79
|
-
dragBadge.font = nativeListTabularFont(ofSize: 12, weight: .semibold)
|
|
80
|
+
dragBadge.font = nativeListTabularFont(ofSize: 12, weight: .semibold, fonts: fonts)
|
|
80
81
|
dragBadge.layer.cornerRadius = 12
|
|
81
82
|
dragBadge.layer.masksToBounds = true
|
|
82
83
|
dragBadge.layer.borderWidth = 1
|
|
@@ -101,6 +102,7 @@ final class NativeListWalletGroupCell: NativeListRendererCell, UIGestureRecogniz
|
|
|
101
102
|
_ item: NativeListItem, theme: [String: Any]?, layout: String,
|
|
102
103
|
checkboxState: (NativeListItem, NativeSelectionTarget?, String) -> String
|
|
103
104
|
) {
|
|
105
|
+
dragBadge.font = nativeListTabularFont(ofSize: 12, weight: .semibold, fonts: fonts)
|
|
104
106
|
members = Self.memberItems(item)
|
|
105
107
|
let keys = Set(members.map(\.key))
|
|
106
108
|
for key in Array(memberViews.keys) where !keys.contains(key) {
|
|
@@ -134,7 +136,7 @@ final class NativeListWalletGroupCell: NativeListRendererCell, UIGestureRecogniz
|
|
|
134
136
|
view.cell.listStyle = listStyle
|
|
135
137
|
view.cell.bind(
|
|
136
138
|
item: member, theme: theme, layout: layout, selected: member.data.bool("selected"),
|
|
137
|
-
checkboxState: checkboxState)
|
|
139
|
+
checkboxState: checkboxState, fonts: fonts)
|
|
138
140
|
root.insertArrangedSubview(view.cell, at: index)
|
|
139
141
|
}
|
|
140
142
|
if let parent = members.first {
|
|
@@ -153,7 +155,7 @@ final class NativeListWalletGroupCell: NativeListRendererCell, UIGestureRecogniz
|
|
|
153
155
|
compactCell?.listStyle = listStyle
|
|
154
156
|
compactCell?.bind(
|
|
155
157
|
item: parent, theme: theme, layout: layout, selected: parent.data.bool("selected"),
|
|
156
|
-
checkboxState: checkboxState)
|
|
158
|
+
checkboxState: checkboxState, fonts: fonts)
|
|
157
159
|
}
|
|
158
160
|
let count = members.dropFirst().filter { ($0.data["draggable"] as? Bool) != false }.count
|
|
159
161
|
dragBadge.text = count > 0 ? "+\(count)" : nil
|
|
@@ -4,6 +4,26 @@ import UIKit
|
|
|
4
4
|
import UniformTypeIdentifiers
|
|
5
5
|
|
|
6
6
|
final class NativeListView: UIView {
|
|
7
|
+
private var fonts = NativeListFontFamilies()
|
|
8
|
+
|
|
9
|
+
func setFontFamiliesJson(_ json: String) {
|
|
10
|
+
guard let next = NativeListFontFamilies(json: json), next != fonts else { return }
|
|
11
|
+
fonts = next
|
|
12
|
+
if interactiveReorderSource != nil { cancelInteractiveReorderForStructuralUpdate() }
|
|
13
|
+
sectionIndexView.refreshFonts(fonts)
|
|
14
|
+
sectionIndexPreview.refreshFonts(fonts)
|
|
15
|
+
invalidateActionAnchor(reason: "layout")
|
|
16
|
+
configureFooterIfPresent()
|
|
17
|
+
var snapshot = dataSource.snapshot()
|
|
18
|
+
snapshot.reconfigureItems(snapshot.itemIdentifiers)
|
|
19
|
+
dataSource.apply(snapshot, animatingDifferences: false)
|
|
20
|
+
flowLayout.invalidateLayout()
|
|
21
|
+
setNeedsLayout()
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
private func configureFooterIfPresent() {
|
|
25
|
+
if let config { configureFooter(config) }
|
|
26
|
+
}
|
|
7
27
|
private var refreshEmittedForDrag = false
|
|
8
28
|
private var minimumDragOffset: CGFloat = 0
|
|
9
29
|
private var containerSlotHeights: [CGFloat] = [0, 0, 0]
|
|
@@ -11,27 +31,11 @@ final class NativeListView: UIView {
|
|
|
11
31
|
// Each root therefore lives in a list-owned host whose origin the list alone controls, so a
|
|
12
32
|
// React layout update can never move a slot out of its native position, even for a frame.
|
|
13
33
|
private var reactContainerSlots: [(content: UIView, host: UIView)] = []
|
|
14
|
-
private let topOverlayHost = UIView()
|
|
15
|
-
private weak var topOverlayContent: UIView?
|
|
16
|
-
private var topEdgeInteraction: UIInteraction?
|
|
17
|
-
private var topEdgeMarker: UILabel?
|
|
18
|
-
private var originalTopEdgeStyle: AnyObject?
|
|
19
|
-
private var topScrollEdgeHard = false
|
|
20
|
-
private var requestedTopOverlayHeight: CGFloat = 0
|
|
21
|
-
private var appliedTopOverlayInset: CGFloat = 0
|
|
22
|
-
|
|
23
34
|
private var lastLaidOutContentHeight: CGFloat?
|
|
24
35
|
private var needsContentShrinkCorrection = false
|
|
25
36
|
private var contentShrinkCorrectionScheduled = false
|
|
26
37
|
|
|
27
38
|
@objc func mountContainerSlot(_ view: UIView, atIndex index: Int) {
|
|
28
|
-
if index == 3 {
|
|
29
|
-
topOverlayContent?.removeFromSuperview()
|
|
30
|
-
topOverlayContent = view
|
|
31
|
-
topOverlayHost.addSubview(view)
|
|
32
|
-
updateTopScrollEdge()
|
|
33
|
-
return
|
|
34
|
-
}
|
|
35
39
|
let host = UIView()
|
|
36
40
|
// Clipping to the reported height keeps new content from overlapping rows until the list
|
|
37
41
|
// has reserved space for it.
|
|
@@ -44,12 +48,6 @@ final class NativeListView: UIView {
|
|
|
44
48
|
}
|
|
45
49
|
|
|
46
50
|
@objc func unmountContainerSlot(_ view: UIView) {
|
|
47
|
-
if topOverlayContent === view {
|
|
48
|
-
view.removeFromSuperview()
|
|
49
|
-
topOverlayContent = nil
|
|
50
|
-
updateTopScrollEdge()
|
|
51
|
-
return
|
|
52
|
-
}
|
|
53
51
|
reactContainerSlots.removeAll { slot in
|
|
54
52
|
guard slot.content === view else { return false }
|
|
55
53
|
view.removeFromSuperview()
|
|
@@ -58,66 +56,6 @@ final class NativeListView: UIView {
|
|
|
58
56
|
}
|
|
59
57
|
}
|
|
60
58
|
|
|
61
|
-
func setTopScrollEdge(hard: Bool, overlayHeight: CGFloat) {
|
|
62
|
-
topScrollEdgeHard = hard
|
|
63
|
-
requestedTopOverlayHeight = overlayHeight.isFinite ? max(0, overlayHeight) : 0
|
|
64
|
-
updateTopScrollEdge()
|
|
65
|
-
setNeedsLayout()
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
private func updateTopScrollEdge() {
|
|
69
|
-
if #available(iOS 26.0, *) {
|
|
70
|
-
let hasOverlay = topScrollEdgeHard && topOverlayContent != nil
|
|
71
|
-
let enabled = hasOverlay && window != nil
|
|
72
|
-
let nextInset = hasOverlay ? requestedTopOverlayHeight : 0
|
|
73
|
-
if nextInset != appliedTopOverlayInset {
|
|
74
|
-
// Do not interrupt UIKit's rebound after a refresh has ended.
|
|
75
|
-
let wasReturningFromPull =
|
|
76
|
-
collectionView.contentOffset.y < -collectionView.adjustedContentInset.top - 0.5
|
|
77
|
-
let logicalOffset = collectionView.contentOffset.y + collectionView.contentInset.top
|
|
78
|
-
var inset = collectionView.contentInset
|
|
79
|
-
inset.top += nextInset - appliedTopOverlayInset
|
|
80
|
-
collectionView.contentInset = inset
|
|
81
|
-
appliedTopOverlayInset = nextInset
|
|
82
|
-
if !wasReturningFromPull {
|
|
83
|
-
collectionView.setContentOffset(
|
|
84
|
-
CGPoint(x: collectionView.contentOffset.x, y: logicalOffset - inset.top),
|
|
85
|
-
animated: false)
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
if enabled && topEdgeInteraction == nil {
|
|
89
|
-
originalTopEdgeStyle = collectionView.topEdgeEffect.style
|
|
90
|
-
// UIKit needs a native element to shape the edge effect around React-drawn content.
|
|
91
|
-
let marker = UILabel(frame: topOverlayHost.bounds)
|
|
92
|
-
marker.autoresizingMask = [.flexibleWidth, .flexibleHeight]
|
|
93
|
-
marker.text = " "
|
|
94
|
-
marker.textColor = .clear
|
|
95
|
-
marker.backgroundColor = .clear
|
|
96
|
-
marker.isUserInteractionEnabled = false
|
|
97
|
-
marker.isAccessibilityElement = false
|
|
98
|
-
marker.accessibilityElementsHidden = true
|
|
99
|
-
topOverlayHost.addSubview(marker)
|
|
100
|
-
topEdgeMarker = marker
|
|
101
|
-
let interaction = UIScrollEdgeElementContainerInteraction()
|
|
102
|
-
interaction.edge = .top
|
|
103
|
-
interaction.scrollView = collectionView
|
|
104
|
-
topOverlayHost.addInteraction(interaction)
|
|
105
|
-
topEdgeInteraction = interaction
|
|
106
|
-
} else if !enabled, let interaction = topEdgeInteraction {
|
|
107
|
-
topOverlayHost.removeInteraction(interaction)
|
|
108
|
-
(interaction as? UIScrollEdgeElementContainerInteraction)?.scrollView = nil
|
|
109
|
-
topEdgeInteraction = nil
|
|
110
|
-
topEdgeMarker?.removeFromSuperview()
|
|
111
|
-
topEdgeMarker = nil
|
|
112
|
-
if let originalTopEdgeStyle = originalTopEdgeStyle as? UIScrollEdgeEffect.Style {
|
|
113
|
-
collectionView.topEdgeEffect.style = originalTopEdgeStyle
|
|
114
|
-
}
|
|
115
|
-
originalTopEdgeStyle = nil
|
|
116
|
-
}
|
|
117
|
-
if enabled { collectionView.topEdgeEffect.style = .hard }
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
|
|
121
59
|
func setContainerSlotHeightsJson(_ json: String) {
|
|
122
60
|
guard let data = json.data(using: .utf8),
|
|
123
61
|
let heights = try? JSONSerialization.jsonObject(with: data) as? [Double],
|
|
@@ -353,7 +291,6 @@ final class NativeListView: UIView {
|
|
|
353
291
|
addSubview(footerContainer)
|
|
354
292
|
addSubview(sectionIndexView)
|
|
355
293
|
addSubview(sectionIndexPreview)
|
|
356
|
-
addSubview(topOverlayHost)
|
|
357
294
|
footerContainer.addSubview(footerCell)
|
|
358
295
|
collectionView.translatesAutoresizingMaskIntoConstraints = false
|
|
359
296
|
footerContainer.translatesAutoresizingMaskIntoConstraints = false
|
|
@@ -505,14 +442,11 @@ final class NativeListView: UIView {
|
|
|
505
442
|
|
|
506
443
|
override func didMoveToWindow() {
|
|
507
444
|
super.didMoveToWindow()
|
|
508
|
-
updateTopScrollEdge()
|
|
509
445
|
updateSectionIndexAttachment()
|
|
510
446
|
}
|
|
511
447
|
|
|
512
448
|
override func layoutSubviews() {
|
|
513
449
|
super.layoutSubviews()
|
|
514
|
-
topOverlayHost.frame = CGRect(x: 0, y: 0, width: collectionView.bounds.width,
|
|
515
|
-
height: requestedTopOverlayHeight)
|
|
516
450
|
updateSectionIndexAttachment()
|
|
517
451
|
let direction = effectiveUserInterfaceLayoutDirection
|
|
518
452
|
if let lastLayoutSize,
|
|
@@ -1666,7 +1600,8 @@ final class NativeListView: UIView {
|
|
|
1666
1600
|
selected: item.data.bool("selected") || config.selectedKeys.contains(item.key),
|
|
1667
1601
|
checkboxState: { [weak self] item, target, fallback in
|
|
1668
1602
|
self?.resolveCheckboxState(item: item, target: target, fallback: fallback) ?? fallback
|
|
1669
|
-
}
|
|
1603
|
+
},
|
|
1604
|
+
fonts: fonts
|
|
1670
1605
|
)
|
|
1671
1606
|
if item.key == interactiveReorderCompactKey {
|
|
1672
1607
|
cell.setWalletGroupReorderCompact(true)
|
|
@@ -2029,7 +1964,9 @@ final class NativeListView: UIView {
|
|
|
2029
1964
|
? floor((availableWidth - CGFloat((config?.gridColumns ?? 2) - 1) * (config?.itemSpacing ?? 0)) / CGFloat(config?.gridColumns ?? 2))
|
|
2030
1965
|
: availableWidth
|
|
2031
1966
|
let rowWidth = allocatedWidth ?? (config?.orientation == "horizontal" ? 280 : columnWidth)
|
|
2032
|
-
if let height = NativeListRendererRegistry.measure(
|
|
1967
|
+
if let height = NativeListRendererRegistry.measure(
|
|
1968
|
+
item, width: rowWidth, theme: config?.theme, layout: config?.layout ?? "linear", fonts: fonts)
|
|
1969
|
+
{
|
|
2033
1970
|
return max(0, height + (NativeListRendererRegistry.appliesSizePreset(item) ? (item.data.string("size") == "small" ? -8 : item.data.string("size") == "large" ? 12 : 0) : 0))
|
|
2034
1971
|
}
|
|
2035
1972
|
return 56
|
|
@@ -2084,7 +2021,6 @@ final class NativeListView: UIView {
|
|
|
2084
2021
|
|
|
2085
2022
|
func dispose() {
|
|
2086
2023
|
guard !disposed else { return }
|
|
2087
|
-
setTopScrollEdge(hard: false, overlayHeight: 0)
|
|
2088
2024
|
disposed = true
|
|
2089
2025
|
|
|
2090
2026
|
disposeActionAnchor()
|
|
@@ -2411,7 +2347,7 @@ extension NativeListView: UICollectionViewDelegateFlowLayout {
|
|
|
2411
2347
|
}
|
|
2412
2348
|
|
|
2413
2349
|
private func railWidth(_ item: NativeListItem) -> CGFloat {
|
|
2414
|
-
NativeListRailRenderer.Resolved(item, theme: config?.theme).horizontalWidth
|
|
2350
|
+
NativeListRailRenderer.Resolved(item, theme: config?.theme, fonts: fonts).horizontalWidth
|
|
2415
2351
|
}
|
|
2416
2352
|
|
|
2417
2353
|
func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
|
|
@@ -2664,6 +2600,11 @@ private struct NativeListSectionIndexEntry {
|
|
|
2664
2600
|
}
|
|
2665
2601
|
|
|
2666
2602
|
private final class NativeListSectionIndexPreviewView: UIView {
|
|
2603
|
+
private var fonts = NativeListFontFamilies()
|
|
2604
|
+
func refreshFonts(_ fonts: NativeListFontFamilies) {
|
|
2605
|
+
self.fonts = fonts
|
|
2606
|
+
label.font = nativeListFont(ofSize: 30, fonts: fonts)
|
|
2607
|
+
}
|
|
2667
2608
|
private let shapeLayer = CAShapeLayer()
|
|
2668
2609
|
private let label = UILabel()
|
|
2669
2610
|
|
|
@@ -2679,7 +2620,7 @@ private final class NativeListSectionIndexPreviewView: UIView {
|
|
|
2679
2620
|
layer.addSublayer(shapeLayer)
|
|
2680
2621
|
label.textAlignment = .center
|
|
2681
2622
|
label.adjustsFontForContentSizeCategory = true
|
|
2682
|
-
label.font = nativeListFont(ofSize: 30)
|
|
2623
|
+
label.font = nativeListFont(ofSize: 30, fonts: fonts)
|
|
2683
2624
|
label.isAccessibilityElement = false
|
|
2684
2625
|
addSubview(label)
|
|
2685
2626
|
}
|
|
@@ -2734,6 +2675,11 @@ private final class NativeListSectionIndexPreviewView: UIView {
|
|
|
2734
2675
|
// OneKey patch: arbitrate index scrubbing against ancestor dismissal gestures.
|
|
2735
2676
|
// private final class NativeListSectionIndexView: UIControl {
|
|
2736
2677
|
private final class NativeListSectionIndexView: UIControl, UIGestureRecognizerDelegate {
|
|
2678
|
+
private var fonts = NativeListFontFamilies()
|
|
2679
|
+
func refreshFonts(_ fonts: NativeListFontFamilies) {
|
|
2680
|
+
self.fonts = fonts
|
|
2681
|
+
updateLabelStyles()
|
|
2682
|
+
}
|
|
2737
2683
|
private static let edgePadding: CGFloat = 8
|
|
2738
2684
|
private static let labelSize: CGFloat = 14
|
|
2739
2685
|
private static let labelSpacing: CGFloat = 16
|
|
@@ -2951,7 +2897,7 @@ private final class NativeListSectionIndexView: UIControl, UIGestureRecognizerDe
|
|
|
2951
2897
|
label.backgroundColor = active ? activeColor : .clear
|
|
2952
2898
|
label.layer.cornerRadius = Self.labelSize / 2
|
|
2953
2899
|
label.layer.masksToBounds = active
|
|
2954
|
-
label.font = nativeListFont(ofSize: 10, weight: active ? .medium : .regular)
|
|
2900
|
+
label.font = nativeListFont(ofSize: 10, weight: active ? .medium : .regular, fonts: fonts)
|
|
2955
2901
|
}
|
|
2956
2902
|
}
|
|
2957
2903
|
}
|
|
@@ -21,7 +21,7 @@ final class NativeListActivityPresentationTests: XCTestCase {
|
|
|
21
21
|
],
|
|
22
22
|
])
|
|
23
23
|
let view = NativeListActivityDetailsView()
|
|
24
|
-
view.bind(item, theme: nil)
|
|
24
|
+
view.bind(item, theme: nil, fonts: NativeListFontFamilies())
|
|
25
25
|
func labels(in view: UIView) -> [UILabel] {
|
|
26
26
|
(view as? UILabel).map { [$0] } ?? view.subviews.flatMap { labels(in: $0) }
|
|
27
27
|
}
|
|
@@ -87,11 +87,13 @@ final class NativeListActivityPresentationTests: XCTestCase {
|
|
|
87
87
|
view.trailingAnchor.constraint(equalTo: container.trailingAnchor),
|
|
88
88
|
view.topAnchor.constraint(equalTo: container.topAnchor),
|
|
89
89
|
])
|
|
90
|
-
view.bind(item, theme: nil)
|
|
90
|
+
view.bind(item, theme: nil, fonts: NativeListFontFamilies())
|
|
91
91
|
container.layoutIfNeeded()
|
|
92
92
|
container.layoutIfNeeded()
|
|
93
93
|
let rendered = ceil(view.frame.height) + vertical * 2
|
|
94
|
-
XCTAssertEqual(
|
|
94
|
+
XCTAssertEqual(
|
|
95
|
+
NativeListActivityDetailsView.measure(data, width: width, fonts: NativeListFontFamilies()),
|
|
96
|
+
rendered, accuracy: 1, name)
|
|
95
97
|
}
|
|
96
98
|
}
|
|
97
99
|
}
|