@onekeyfe/react-native-native-list 6.7.0-alpha.428 → 6.7.0-alpha.430
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/docs/SPEC.md
CHANGED
|
@@ -242,7 +242,8 @@ titleSegments?: readonly {
|
|
|
242
242
|
|
|
243
243
|
`identity.titleLeadingIcon` is an optional `{ name, tintColor?,
|
|
244
244
|
accessibilityLabel? }`: a 16-point glyph before the title text or its runs,
|
|
245
|
-
with a 6-point gap, vertically centered on the title line.
|
|
245
|
+
with a 6-point gap, vertically centered on the title line. It keeps its 16
|
|
246
|
+
points: a long title, or its shrinking run, truncates first. The name comes from
|
|
246
247
|
the same closed icon set as `titleIcon`; an unmapped name leaves an empty
|
|
247
248
|
16-point slot. `tintColor` is a hex `#RRGGBB` or `#RRGGBBAA` color and defaults
|
|
248
249
|
to the theme's `iconSubdued`. Without `accessibilityLabel` the glyph is hidden
|
|
@@ -256,7 +257,7 @@ previous runs and glyph, so a row without them never shows another row's.
|
|
|
256
257
|
|
|
257
258
|
| Platform | Title runs | Leading icon |
|
|
258
259
|
| --- | --- | --- |
|
|
259
|
-
| iOS | `NativeListTitleSegmentsLabel` draws the runs at the widths that `NativeListTitleSegmentLayout.swift` allocates for its bounds; it fills the title row in place of the row's filler. | `
|
|
260
|
+
| iOS | `NativeListTitleSegmentsLabel` draws the runs at the widths that `NativeListTitleSegmentLayout.swift` allocates for its bounds; it fills the title row in place of the row's filler. | `NativeListIconImageView`, first in the title row stack. A plain title beside it drops below required horizontal compression resistance, as beside `titleIcon`, so the title truncates before the glyph narrows. |
|
|
260
261
|
| Android | `NativeListTitleSegmentsView`, a `TextView` whose text is rebuilt for each measured width from `NativeListTitleSegmentLayout.kt` and which measures to the width it is offered. `PackedTitleLineLayout.titleChild` names the flexible title view, so a view may precede it. | `OneKeyIconView`, first in the title line. |
|
|
261
262
|
| Web | A flex line that fills the title line: the shrinking run is `flex: 0 1 auto; min-width: 0`, the others `flex: 0 0 auto` with a `max-width` percentage for a cap. | An icon element before the title text. |
|
|
262
263
|
|
|
@@ -265,7 +266,9 @@ Conformance: `src/validation.ts` (`assertTitleSegments`,
|
|
|
265
266
|
`src/web/templates/IdentityRowRenderer.ts` with `IdentityTitleRunsWeb.test.ts`
|
|
266
267
|
(run styles, flex behavior, accessibility, rebind);
|
|
267
268
|
`ios/NativeListTitleSegmentLayout.swift` with the SwiftPM
|
|
268
|
-
`NativeListTitleSegmentLayoutTests`;
|
|
269
|
+
`NativeListTitleSegmentLayoutTests`; the iOS leading glyph beside a long plain
|
|
270
|
+
title with the XCTest `NativeListIdentityTitleIconLayoutTests`;
|
|
271
|
+
`NativeListTitleSegmentLayout.kt` with the
|
|
269
272
|
JVM `NativeListTitleSegmentLayoutTest`. iOS, Android and Web runtime acceptance is pending: recipient rows
|
|
270
273
|
with long wallet and account names in both truncation directions, narrow rows,
|
|
271
274
|
dark mode, dynamic type and configured fonts, and recycling between rows with
|
|
@@ -722,6 +722,9 @@ final class NativeListIdentityCell: NativeListRendererCell {
|
|
|
722
722
|
titleLeadingIconView.accessibilityLabel = label.isEmpty ? nil : label
|
|
723
723
|
titleLeadingIconView.isAccessibilityElement = !label.isEmpty
|
|
724
724
|
titleRowStack.setCustomSpacing(6, after: titleLeadingIconView)
|
|
725
|
+
// As beside `titleIcon`: a plain title left at `.required` collapses the
|
|
726
|
+
// glyph's 999 width constraint instead of truncating.
|
|
727
|
+
titleLabel.setContentCompressionResistancePriority(.defaultHigh, for: .horizontal)
|
|
725
728
|
}
|
|
726
729
|
let titleSuffixes = item.data.dictionaries("titleSuffixes")
|
|
727
730
|
if !titleSuffixes.isEmpty {
|
|
@@ -78,4 +78,36 @@ final class NativeListIdentityTitleIconLayoutTests: XCTestCase {
|
|
|
78
78
|
XCTAssertGreaterThan(badgeFrame.minX, iconFrame.maxX)
|
|
79
79
|
XCTAssertLessThanOrEqual(badgeFrame.maxX, cell.bounds.width)
|
|
80
80
|
}
|
|
81
|
+
|
|
82
|
+
// An address book row: a plain title after the 16pt `titleLeadingIcon`. A
|
|
83
|
+
// long name truncates after the glyph instead of squeezing it to nothing.
|
|
84
|
+
func testLongPlainTitleTruncatesAfterTheLeadingIcon() throws {
|
|
85
|
+
let cell = NativeListIdentityCell(frame: CGRect(x: 0, y: 0, width: 320, height: 60))
|
|
86
|
+
let window = UIWindow(frame: CGRect(x: 0, y: 0, width: 320, height: 200))
|
|
87
|
+
window.addSubview(cell)
|
|
88
|
+
let leadingIcon = try child(cell, "titleLeadingIconView", as: UIImageView.self)
|
|
89
|
+
let titleLabel = try child(cell, "titleLabel", as: UILabel.self)
|
|
90
|
+
let item = try NativeListItem(data: [
|
|
91
|
+
"key": "book", "type": "identity",
|
|
92
|
+
"title": "A very long address book name that cannot possibly fit on one line",
|
|
93
|
+
"height": 60,
|
|
94
|
+
"leading": ["kind": "token", "fallbackIcon": ["name": "CryptoCoinOutline"]],
|
|
95
|
+
"titleLeadingIcon": ["name": "BookOpenOutline"],
|
|
96
|
+
"subtitle": "0x1234...abcd",
|
|
97
|
+
])
|
|
98
|
+
cell.bind(item: item, theme: nil, layout: "linear", selected: false,
|
|
99
|
+
checkboxState: { _, _, fallback in fallback }, fonts: NativeListFontFamilies())
|
|
100
|
+
cell.layoutIfNeeded()
|
|
101
|
+
|
|
102
|
+
let iconFrame = leadingIcon.convert(leadingIcon.bounds, to: cell)
|
|
103
|
+
let labelFrame = titleLabel.convert(titleLabel.bounds, to: cell)
|
|
104
|
+
XCTAssertFalse(leadingIcon.isHidden)
|
|
105
|
+
XCTAssertEqual(leadingIcon.bounds.width, 16, accuracy: 0.5,
|
|
106
|
+
"the leading glyph keeps its 16pt width")
|
|
107
|
+
XCTAssertEqual(labelFrame.minX, iconFrame.maxX + 6, accuracy: 1,
|
|
108
|
+
"the title follows the glyph with the 6pt gap")
|
|
109
|
+
XCTAssertLessThan(titleLabel.bounds.width, titleLabel.intrinsicContentSize.width,
|
|
110
|
+
"the title truncates instead of the glyph")
|
|
111
|
+
XCTAssertLessThanOrEqual(labelFrame.maxX, cell.bounds.width)
|
|
112
|
+
}
|
|
81
113
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@onekeyfe/react-native-native-list",
|
|
3
|
-
"version": "6.7.0-alpha.
|
|
3
|
+
"version": "6.7.0-alpha.430",
|
|
4
4
|
"description": "Template-driven native RecyclerView and UICollectionView for React Native",
|
|
5
5
|
"source": "./src/index.ts",
|
|
6
6
|
"main": "./lib/module/index.js",
|
|
@@ -89,8 +89,8 @@
|
|
|
89
89
|
"typescript": "^5.9.2"
|
|
90
90
|
},
|
|
91
91
|
"peerDependencies": {
|
|
92
|
-
"@onekeyfe/react-native-image": "6.7.0-alpha.
|
|
93
|
-
"@onekeyfe/react-native-native-logger": "6.7.0-alpha.
|
|
92
|
+
"@onekeyfe/react-native-image": "6.7.0-alpha.430",
|
|
93
|
+
"@onekeyfe/react-native-native-logger": "6.7.0-alpha.430",
|
|
94
94
|
"react": "*",
|
|
95
95
|
"react-native": "*",
|
|
96
96
|
"react-native-nitro-modules": "0.37.0"
|