@onekeyfe/react-native-native-list 6.7.0-20 → 6.7.0-21
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/android/src/main/java/com/onekey/nativelist/NativeListActivityDetailsView.kt +29 -4
- package/android/src/main/java/com/onekey/nativelist/NativeListActivityRenderer.kt +6 -10
- package/android/src/main/java/com/onekey/nativelist/NativeListAdapter.kt +17 -1
- package/android/src/main/java/com/onekey/nativelist/NativeListDataRowRenderer.kt +15 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListIdentityRenderer.kt +33 -2
- package/android/src/main/java/com/onekey/nativelist/NativeListMarketRenderer.kt +92 -28
- package/android/src/main/java/com/onekey/nativelist/NativeListModels.kt +13 -10
- package/android/src/main/java/com/onekey/nativelist/NativeListView.kt +33 -8
- package/android/src/test/java/com/margelo/nitro/nativelist/NativeListActivityHostClipPolicyTest.kt +11 -5
- package/docs/ROW_TEMPLATES.md +10 -2
- package/docs/SPEC.md +270 -42
- package/ios/NativeListActivityDetailsView.swift +13 -4
- package/ios/NativeListIdentityRenderer.swift +50 -3
- package/ios/NativeListMarketRenderer.swift +113 -18
- package/ios/RNCNativeListView.swift +21 -3
- package/ios/tests/NativeListActivityPresentationTests.swift +97 -0
- package/ios/tests/NativeListLifecycleTests.swift +73 -4
- package/ios/tests/NativeListMarketMetricsTests.swift +117 -0
- package/lib/module/NativeList.js +25 -6
- package/lib/module/NativeList.web.js +9 -12
- package/lib/module/models.js +2 -0
- package/lib/module/validation.js +695 -114
- package/lib/module/web/NativeListWebEngine.js +3 -9
- package/lib/module/web/templates/IdentityRowRenderer.js +58 -4
- package/lib/typescript/src/models.d.ts +27 -14
- package/lib/typescript/src/validation.d.ts +7 -2
- package/package.json +3 -3
- package/src/NativeList.tsx +30 -10
- package/src/NativeList.web.tsx +10 -14
- package/src/models.ts +158 -153
- package/src/validation.ts +1757 -167
- package/src/web/NativeListWebEngine.ts +6 -10
- package/src/web/templates/IdentityRowRenderer.ts +70 -4
package/docs/SPEC.md
CHANGED
|
@@ -176,6 +176,57 @@ after semantic text styling. Both lines retain their default size, tone, line
|
|
|
176
176
|
height, right alignment and accessibility text. These fields add no action or
|
|
177
177
|
hit target and travel in existing snapshot JSON without a Nitro ABI change.
|
|
178
178
|
|
|
179
|
+
### Identity title image
|
|
180
|
+
|
|
181
|
+
Status: implemented in local source, unreleased. Type checks, JS/Web tests,
|
|
182
|
+
Web runtime checks, package build, iOS XCTest-target compilation, Android
|
|
183
|
+
production/instrumentation-test compilation and JVM tests pass. Focused iOS
|
|
184
|
+
Simulator XCTest and Android emulator instrumentation verify image lifecycle,
|
|
185
|
+
null removal and wallet-sidebar layout. Complete wallet App acceptance remains
|
|
186
|
+
pending.
|
|
187
|
+
An `identity` row may supply `titleImage: { image, accessibilityLabel?,
|
|
188
|
+
hoverActionKey? }`. `image` uses the existing `ImageSource` contract and must
|
|
189
|
+
declare equal finite width and height within 1...40 logical units. The image
|
|
190
|
+
is circular, follows the title and any title icons with a 4-point gap, and
|
|
191
|
+
precedes title suffixes and inline badges. It reserves its declared square
|
|
192
|
+
while loading or after failure, so neither state moves the text. Existing
|
|
193
|
+
rows without this field keep their current layout. The image does not change
|
|
194
|
+
row identity or infer a stock, issuer, or other product meaning.
|
|
195
|
+
|
|
196
|
+
iOS and Android use the existing OneKeyImage-backed slot, request options and
|
|
197
|
+
retry limits. Slots belong to the mounted row renderer; OneKeyImage owns image
|
|
198
|
+
caches. Text-only rebinds retain an unchanged row/source request. Source or row
|
|
199
|
+
changes, removal, recycling and disposal cancel prior work and prevent stale
|
|
200
|
+
completion from painting the next binding. Failure leaves the reserved square
|
|
201
|
+
empty; the SDK adds no title-image fallback request or separate cache.
|
|
202
|
+
|
|
203
|
+
On Web, optional `hoverActionKey` uses the title icon's existing help semantics
|
|
204
|
+
and `leadingAction` anchor source: mouse/pen entry opens an anchored help event,
|
|
205
|
+
departure invalidates it, mouse/pen press closes it until departure, and touch
|
|
206
|
+
press toggles it. Pressing this help target does not activate the row. Without
|
|
207
|
+
help, the image participates in the ordinary row press. It adds no tab stop.
|
|
208
|
+
Native renderers ignore this Web-only help field and preserve ordinary row
|
|
209
|
+
presses. The consumer owns the tooltip text and presentation. Omitted
|
|
210
|
+
`accessibilityLabel` makes the image decorative; a supplied label describes it.
|
|
211
|
+
|
|
212
|
+
Android wallet-sidebar rows with a title image reserve image width and pack the
|
|
213
|
+
wallet name with the image as one centered group. Long names ellipsize within
|
|
214
|
+
the remaining space; removing the image restores the full-width centered name.
|
|
215
|
+
|
|
216
|
+
Full snapshots without `titleImage` remove the image and old help anchor.
|
|
217
|
+
Explicit patch replacement updates the descriptor; an omitted patch field
|
|
218
|
+
leaves it unchanged. Null patches and empty image URIs remove the image. Development guards
|
|
219
|
+
reject malformed descriptors and invalid display geometry; production sanitizes
|
|
220
|
+
optional decoration as described in the validation contract. A production patch
|
|
221
|
+
that supplies a malformed title-image replacement explicitly clears the old
|
|
222
|
+
image and help target instead of retaining stale decoration. The field travels in existing JSON and does not change the Nitro ABI;
|
|
223
|
+
consumers must use a native SDK that implements the field before enabling it.
|
|
224
|
+
|
|
225
|
+
Acceptance covers protocol validation, image/source replacement and removal,
|
|
226
|
+
text-only request retention, Web help-action isolation and anchor cleanup,
|
|
227
|
+
native bind/recycle geometry, and native compilation. Device and complete App
|
|
228
|
+
acceptance must be reported separately from source and DOM tests.
|
|
229
|
+
|
|
179
230
|
### Identity row risk-management controls
|
|
180
231
|
|
|
181
232
|
Status: implemented in source for local consumers, unreleased. Focused validation,
|
|
@@ -324,6 +375,33 @@ migration itself does not change any other protocol field.
|
|
|
324
375
|
|
|
325
376
|
## Lifecycle and concurrency
|
|
326
377
|
|
|
378
|
+
### Updates before native host binding
|
|
379
|
+
|
|
380
|
+
Status: implemented in local source, unreleased. The delayed-host regression fails
|
|
381
|
+
on the previous wrapper and passes with this change; 438 package JS/Web tests and
|
|
382
|
+
the package type check pass. This local JavaScript revision is verified with real
|
|
383
|
+
iOS Fabric/UICollectionView rendering on an iPad simulator: delayed-ref,
|
|
384
|
+
parent-layout-before-ref without an artificial delay, and host-ready control
|
|
385
|
+
scenarios all retain the three complete rows after a later single-row update.
|
|
386
|
+
The actual Home list also recovered all six rows after the task-specific Metro
|
|
387
|
+
reload. Earlier natural re-entry evidence included development Metro bundle
|
|
388
|
+
re-requests, so it does not establish a menu-only trigger or a Sui-specific natural
|
|
389
|
+
reproduction. Android device acceptance remains unverified.
|
|
390
|
+
|
|
391
|
+
Valid snapshots and row patches accepted before the native host is available MUST
|
|
392
|
+
retain the latest owned logical state. When that host binds, its rows MUST reflect
|
|
393
|
+
all accepted updates that are eligible for presentation, including updates to rows
|
|
394
|
+
that do not change again afterward. Later single-row updates MUST NOT leave other
|
|
395
|
+
rows at their initial placeholders. Existing disclosure measurement gates and
|
|
396
|
+
snapshot replacement semantics still apply. Once the host is ready, ordinary row
|
|
397
|
+
patches MUST remain incremental rather than requiring a complete snapshot for each
|
|
398
|
+
patch. This contract does not add a public prop, method, or Nitro ABI field.
|
|
399
|
+
|
|
400
|
+
Conformance covers multiple pre-bind patch batches, newer complete prop and
|
|
401
|
+
imperative snapshots, rejected updates, equivalent prop clones after slot layout,
|
|
402
|
+
selection state, repeated callbacks, distinct replacement hosts, and incremental
|
|
403
|
+
single-row updates after binding.
|
|
404
|
+
|
|
327
405
|
Full binding must work without a preceding recycle callback, including
|
|
328
406
|
style set/change/clear and content A → B. A binding epoch invalidates stale
|
|
329
407
|
image callbacks and action anchors. Recycling/disposal releases pending work
|
|
@@ -333,6 +411,46 @@ image that already loaded. Common container styling clears what it wrote on the
|
|
|
333
411
|
next bind, including properties it set on template children. UI mutation remains on the platform
|
|
334
412
|
UI thread; [DESIGN.md](DESIGN.md) describes update and event ownership.
|
|
335
413
|
|
|
414
|
+
### Android vertical-drag React touch cancellation
|
|
415
|
+
|
|
416
|
+
Status: implemented; four real Android MotionEvent/JSTouchDispatcher regressions
|
|
417
|
+
passed on a dedicated API 34 emulator on 2026-10-30. The focused regression is
|
|
418
|
+
in `native-tests/android/NativeListTouchDeliveryTest.kt`; build and run
|
|
419
|
+
instructions are in that directory's README. Physical-device press/scroll
|
|
420
|
+
acceptance remains separate.
|
|
421
|
+
|
|
422
|
+
This behavior applies to every vertical NativeList, including standalone lists
|
|
423
|
+
outside a CollapsiblePager and touches beginning on React container slots.
|
|
424
|
+
On the UI thread, movement exceeding Android touch slop with vertical
|
|
425
|
+
displacement at least equal to horizontal displacement confirms a vertical
|
|
426
|
+
drag. An initially horizontal movement may become vertical while the list still
|
|
427
|
+
receives the stream; once vertical, ownership stays vertical until release or
|
|
428
|
+
cancellation. Horizontal lists retain their existing touch behavior.
|
|
429
|
+
|
|
430
|
+
The list notifies its React root of native gesture ownership once per confirmed
|
|
431
|
+
drag, cancelling the active React touch before finger-up. Later MOVE events MUST
|
|
432
|
+
NOT repeat that notification. The listener does not consume the stream: native
|
|
433
|
+
RecyclerView scrolling continues. A stationary tap or movement below touch slop
|
|
434
|
+
MUST retain ordinary React touch-end delivery without native-gesture start/end
|
|
435
|
+
notifications. The existing `keyboardDismissMode: 'on-drag'` behavior shares the
|
|
436
|
+
confirmed-drag boundary.
|
|
437
|
+
|
|
438
|
+
ACTION_UP and ACTION_CANCEL finish a started native gesture exactly once and
|
|
439
|
+
release the parent's interception restriction, even after RecyclerView has
|
|
440
|
+
intercepted its child and stops invoking the item-touch interception listener.
|
|
441
|
+
They clear vertical ownership; the next ACTION_DOWN resets direction and
|
|
442
|
+
gesture tracking. Android's touch-target removal cancellation must finish the
|
|
443
|
+
old stream before a retained list is reattached or its slots are reused, so the
|
|
444
|
+
next tap is not suppressed by the previous drag. Disposal releases the listener
|
|
445
|
+
through the existing detached-resource cleanup. This change adds no prop or
|
|
446
|
+
callback and changes neither iOS nor Web touch handling.
|
|
447
|
+
|
|
448
|
+
Conformance uses real MotionEvent dispatch through NativeListView/RecyclerView
|
|
449
|
+
and React Native's JSTouchDispatcher: vertical drag produces one touch-cancel
|
|
450
|
+
and one native end, a tap produces touch-end, and cancellation/removal followed
|
|
451
|
+
by reuse leaves the next tap functional. This proves native touch delivery, not
|
|
452
|
+
execution of a JavaScript press handler or physical-device gesture feel.
|
|
453
|
+
|
|
336
454
|
### Android reorder cancellation
|
|
337
455
|
|
|
338
456
|
Status: implemented; three real Android View/callback regressions verified on
|
|
@@ -445,37 +563,69 @@ row positions. An accepted complete snapshot reuses that index only when its
|
|
|
445
563
|
generation and ordered `(key, type)` sequence match the prior accepted
|
|
446
564
|
snapshot; otherwise it replaces the index. Reorder commits rebuild it and
|
|
447
565
|
disposal clears it. Patch batches reuse the index and never include retiring
|
|
448
|
-
presentation rows in it.
|
|
449
|
-
|
|
450
|
-
|
|
566
|
+
presentation rows in it. Native hosts validate each received canonical batch before changing config or
|
|
567
|
+
presentation; invalid native batches leave both unchanged. The shared production
|
|
568
|
+
JS boundary first isolates rejected row/group units, so a native batch contains
|
|
569
|
+
only accepted canonical updates. iOS updates only changed accepted entries in its
|
|
451
570
|
presentation lookup after a valid patch, preserving any retiring rows.
|
|
452
571
|
|
|
453
572
|
### Validation environments and rejected input
|
|
454
573
|
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
574
|
+
Status: implemented in source; acceptance and remaining runtime gaps are recorded below.
|
|
575
|
+
|
|
576
|
+
Development runs strict contract assertions after shared null/empty-image
|
|
577
|
+
normalization. Production sanitizes optional decorations without rejecting
|
|
578
|
+
valid business content: invalid colors/styles are omitted, invalid images use
|
|
579
|
+
existing placeholders, and positive title-image dimensions are clamped to a
|
|
580
|
+
square of 1...40 logical units. Image headers are string dictionaries, never
|
|
581
|
+
interpreted as geometry. Unsafe object graphs are rejected before normalization.
|
|
582
|
+
|
|
583
|
+
Shared image URI validation accepts the entire `onekey-avatar:` scheme,
|
|
584
|
+
case-insensitively, in snapshots and row patches on iOS, Android and Web. It does
|
|
585
|
+
not restrict the host, version, path, query string or fragment, and preserves the
|
|
586
|
+
URI without decoding. Existing image URI schemes retain their acceptance rules.
|
|
587
|
+
Unsupported image URIs fail development assertions and are sanitized out in
|
|
588
|
+
production. This is validation acceptance only; avatar decoding and loading
|
|
589
|
+
remain owned by the platform image loader or Web avatar worker.
|
|
590
|
+
|
|
591
|
+
A complete snapshot remains atomic after decoration sanitization: invalid
|
|
592
|
+
schema, duplicate/missing identities, required business fields or wallet-group
|
|
593
|
+
parent/children relationships reject the snapshot. No row is silently removed.
|
|
594
|
+
Production normalizes contiguous group positions and filters selection to
|
|
595
|
+
selectable keys, respecting none/single modes.
|
|
596
|
+
|
|
597
|
+
Patches use omitted/undefined fields as no-ops. Null explicitly removes an
|
|
598
|
+
optional field on JS, Web, iOS and Android; required fields cannot be cleared.
|
|
599
|
+
Empty optional images and empty top-level segment arrays normalize to null in
|
|
600
|
+
patches and absence in snapshots. Empty images remove their outer titleImage
|
|
601
|
+
or media wrapper. This protocol requires native binaries with null-removal
|
|
602
|
+
support; callers must not enable it against older native SDK implementations.
|
|
603
|
+
|
|
604
|
+
Market price remains required and nonblank. Updating nonempty priceSegments
|
|
605
|
+
requires a price in the same canonical patch; callers own matching formatted
|
|
606
|
+
text (the validator does not reconstruct subscript prices). Updating price
|
|
607
|
+
without segments clears an existing overlay. For identity/market subtitles,
|
|
608
|
+
updating one representation clears the old other representation unless both
|
|
609
|
+
are supplied; clearing segments alone retains the base text. Activity has no
|
|
610
|
+
subtitle pair. Market quote changes with an existing/new webTable must include
|
|
611
|
+
matching table data or explicitly remove webTable.
|
|
612
|
+
|
|
613
|
+
Development rejects invalid patch batches atomically. Production isolates
|
|
614
|
+
failures to each target key and its coupled groupId: all updates to a key are
|
|
615
|
+
merged in order before validation, and a failure rejects that unit while other
|
|
616
|
+
valid units commit. Financial-value and interactive accessories with missing
|
|
617
|
+
required data fail their row; malformed purely decorative accessories are
|
|
618
|
+
removed. Diagnostics contain locations, never row values or image URLs.
|
|
619
|
+
|
|
620
|
+
All targets share the canonical accepted patches. The accepted JS rows and
|
|
621
|
+
serialized native changes derive from the same result. Native owned snapshots
|
|
622
|
+
and accepted Web engine snapshots validate only changed rows during patches;
|
|
623
|
+
unchanged rows are not rescanned. Direct helpers receiving an unowned baseline
|
|
624
|
+
validate that baseline once before incremental merging. Native owned snapshots
|
|
625
|
+
are immutable and indexed by key. Initial invalid snapshots render empty;
|
|
626
|
+
rejected later snapshots retain the last accepted snapshot. Rejected patch
|
|
627
|
+
units retain their previous complete rows. Direct validators still throw on
|
|
628
|
+
unrecoverable input. Image loading failures remain the loader's responsibility.
|
|
479
629
|
|
|
480
630
|
`planNativeListPatches(previous, next)` is an explicit, pure public helper for
|
|
481
631
|
callers that own two valid, immutable snapshots. It returns a readonly empty
|
|
@@ -498,14 +648,25 @@ Rejection emits a diagnostic without including row keys, text or image URLs.
|
|
|
498
648
|
Explicit calls to the exported validation functions still throw on rejected
|
|
499
649
|
input, so development tooling can inspect the full contract failure. Rejection
|
|
500
650
|
does not imply that the requested update succeeded. No row identity is trimmed,
|
|
501
|
-
truncated or regenerated, and no
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
651
|
+
truncated or regenerated, and no row is silently dropped from a snapshot.
|
|
652
|
+
|
|
653
|
+
Acceptance for this revision: 429 JS/Web tests pass, including native React
|
|
654
|
+
wrapper containment, canonical null/undefined semantics, price/segment pairing,
|
|
655
|
+
production row/group isolation and unchanged-row access checks. Package type
|
|
656
|
+
checks, lint (zero errors; existing warnings) and test-integrity checks pass.
|
|
657
|
+
iOS production/XCTest targets and Android production/instrumentation targets
|
|
658
|
+
compile; 29 Android JVM tests pass. Four focused iOS 26.5 XCTest cases verify
|
|
659
|
+
title-icon packing, title-image reuse and null removal. Android 15/API 35
|
|
660
|
+
instrumentation verifies wallet-sidebar image bounds, long-title ellipsis,
|
|
661
|
+
and full-width title restoration after removal. Shared JS/Web regressions also
|
|
662
|
+
verify that malformed production title-image replacements clear the previous
|
|
663
|
+
image and help anchor. Full App acceptance remains pending.
|
|
664
|
+
|
|
665
|
+
Wallet groups use the actual embedded parent/children model, not memberKeys
|
|
666
|
+
references. groupId/groupPosition remain snapshot-owned fields; production
|
|
667
|
+
patch failures also reject other patched rows in the same existing groupId.
|
|
668
|
+
Unknown extension fields (including unsupported sparkline/changeHighlight
|
|
669
|
+
models) are ignored in production rather than introducing a new renderer API.
|
|
509
670
|
|
|
510
671
|
## Platform contract
|
|
511
672
|
|
|
@@ -617,7 +778,14 @@ Host clipping is per-bind state. A row view that serves several row shapes
|
|
|
617
778
|
(the Android Activity view serves the legacy row and the rich `amounts` row) is
|
|
618
779
|
reused across binds, so each bind MUST derive clipping from the item it binds
|
|
619
780
|
(`nativeListActivityHostClips`): a view that last showed an overhanging badge
|
|
620
|
-
clips again when it is rebound to a row without one.
|
|
781
|
+
clips again when it is rebound to a row without one. The rule follows the
|
|
782
|
+
visual, not the row shape: the rich row renders its leading visual on the
|
|
783
|
+
details view, so that view and every column between the visual and the host
|
|
784
|
+
stop clipping too, and the host derives its own clipping from the details
|
|
785
|
+
view's visual (`leadingOverhangs`, OK-66275). Before this rule the rich branch
|
|
786
|
+
forced the host's clipping back on and left the details view at Android's
|
|
787
|
+
defaults, so the app's history rows (which always carry `amounts`) still showed
|
|
788
|
+
the badge cut at the bottom-right after the legacy branch had been fixed.
|
|
621
789
|
|
|
622
790
|
The row's own shape still clips on every platform: iOS masks the cell to its
|
|
623
791
|
corner radius (`masksToBounds`), Web keeps the row `overflow: hidden`, and
|
|
@@ -654,9 +822,10 @@ over the badge. The per-source geometry is one pure function on Android
|
|
|
654
822
|
`NativeListLeadingVisual.layoutSubviews` on iOS; both restore the stacking
|
|
655
823
|
order by role on every bind because slots are reused across roles.
|
|
656
824
|
|
|
657
|
-
The Android Activity renderer also applies the badge-overhang rule above
|
|
658
|
-
(`requestsUnclippedHost` stops the content row
|
|
659
|
-
|
|
825
|
+
The Android Activity renderer also applies the badge-overhang rule above on
|
|
826
|
+
both of its branches (`requestsUnclippedHost` stops the legacy content row, the
|
|
827
|
+
rich details view with its columns, and the row padding clipping), so the
|
|
828
|
+
history rows' network badges render whole instead of cut flat.
|
|
660
829
|
|
|
661
830
|
## Failures, fallback and limits
|
|
662
831
|
|
|
@@ -1308,9 +1477,14 @@ secondary text and subscript text segments. Segments are caller-formatted and
|
|
|
1308
1477
|
never interpreted as numbers by NativeList. Omission preserves the legacy tree.
|
|
1309
1478
|
|
|
1310
1479
|
`presentation: stacked` places the amount lines after the identity column and
|
|
1311
|
-
right-aligns them
|
|
1312
|
-
|
|
1313
|
-
|
|
1480
|
+
right-aligns them. In `table`, the identity column includes its leading visual
|
|
1481
|
+
and gap; identity, amounts and an optional fee use stable widths in the ratio
|
|
1482
|
+
`1:1:0.6` after inter-column gaps. Without fee, identity and amounts split the
|
|
1483
|
+
remaining width equally. Amount content stays start-aligned within its column;
|
|
1484
|
+
native fee content stays end-aligned; Web retains its existing start alignment.
|
|
1485
|
+
Fee text length and leading visibility cannot move the amount column. These
|
|
1486
|
+
native widths match the existing Web table layout. Fee supports label, primary
|
|
1487
|
+
and secondary text with their own segments; `hidden` preserves its column width
|
|
1314
1488
|
while hiding its contents. Up to four uniquely keyed title badges use declared
|
|
1315
1489
|
tones. `descriptionActionKey` makes only the description emit that action with
|
|
1316
1490
|
source `description`; footer actions retain their existing source/keys and
|
|
@@ -1331,6 +1505,15 @@ baseline, matching NumberSizeableText), badge tone/clear, hidden fee, disabled
|
|
|
1331
1505
|
actions, description anchors, dark/RTL/font scaling and explicit/automatic height.
|
|
1332
1506
|
|
|
1333
1507
|
|
|
1508
|
+
Table regression acceptance additionally measures amount-column start, width and
|
|
1509
|
+
center across short/long/hidden fee, leading visibility, 1/2/6/32 amount lines and
|
|
1510
|
+
table/stacked reuse. Android DataRow primary and secondary groups honor their
|
|
1511
|
+
resolved text-role alignment (role style first, then column alignment), including
|
|
1512
|
+
start/center/end and styled/unstyled reuse. The secondary-prefix gap is present
|
|
1513
|
+
only when that prefix is visible; legacy linear rendering is unchanged. The UIKit
|
|
1514
|
+
regression explicitly forces each renderer view's direction; React Native/Fabric
|
|
1515
|
+
host direction propagation and real App RTL remain unverified.
|
|
1516
|
+
|
|
1334
1517
|
### Android ancestor scroll distance
|
|
1335
1518
|
|
|
1336
1519
|
Threshold hysteresis combines the primary RecyclerView's actual consumed scroll
|
|
@@ -1508,6 +1691,51 @@ row/presentation recycling, strict validation, native dictionary safe-ignore,
|
|
|
1508
1691
|
header/body geometry, 100 quote ticks preserving nodes with zero geometry reads,
|
|
1509
1692
|
then a real complex Market table before expanding to all five families.
|
|
1510
1693
|
|
|
1694
|
+
### Native Market metric columns
|
|
1695
|
+
|
|
1696
|
+
Status: implemented in local source, unreleased; native runtime verification
|
|
1697
|
+
pending. A `market` row may supply two or three ordered, uniquely
|
|
1698
|
+
keyed text columns through `metrics`, typed as a `Pick<DataColumn, ...>` of
|
|
1699
|
+
the supported text fields. Each column uses
|
|
1700
|
+
the text subset of `DataColumn`: key, primary text and segments, optional
|
|
1701
|
+
secondary text and segments, weight, alignment, and primary/secondary tone.
|
|
1702
|
+
Icon and secondary-leading fields are rejected in development and stripped by
|
|
1703
|
+
the existing production decoration sanitizer.
|
|
1704
|
+
Keys are nonempty and callers format all text. The row keeps its required
|
|
1705
|
+
`price` and `change` fields as compact fallbacks. When `metrics` is present,
|
|
1706
|
+
iOS and Android display the existing leading action, visual, title, subtitle,
|
|
1707
|
+
and Market badges, then the metric columns in place of the compact price and
|
|
1708
|
+
change block. The metrics are authoritative for this native presentation; the
|
|
1709
|
+
SDK does not infer their values from the fallback fields or product data.
|
|
1710
|
+
The default native accessibility label includes the title and subtitle followed
|
|
1711
|
+
by the displayed metric text, primary then secondary, in column order. It
|
|
1712
|
+
updates with each quote. An explicit row accessibility label takes precedence.
|
|
1713
|
+
The metrics use their own text tones and alignment, with both lines aligned
|
|
1714
|
+
the same way; omitted alignment defaults to `end`. Existing change block
|
|
1715
|
+
width, height, and corner radius do not
|
|
1716
|
+
apply to metric columns. The title content receives a relative weight of two;
|
|
1717
|
+
metric columns receive their declared `weight` (1...3, default one) after the
|
|
1718
|
+
row's existing action, visual, padding, and gaps take their space. The SDK
|
|
1719
|
+
does not choose a mode from screen width. Without `metrics`, all platforms
|
|
1720
|
+
retain their existing compact Market presentation. Web ignores `metrics` and
|
|
1721
|
+
continues using `webTable` when supplied.
|
|
1722
|
+
|
|
1723
|
+
Metric values travel in the existing row snapshot JSON and do not change the
|
|
1724
|
+
Nitro ABI, row key, action keys, badge anchors, or scroll ownership. Full
|
|
1725
|
+
snapshots may add, replace, or omit `metrics`; omission restores compact mode.
|
|
1726
|
+
An explicit patch with a valid two- or three-column array replaces metrics,
|
|
1727
|
+
while an omitted patch field leaves them unchanged. A full snapshot is used
|
|
1728
|
+
to remove metrics from a wide row; this contract adds no null patch meaning.
|
|
1729
|
+
Binding and recycling clear inactive metric and compact views in both
|
|
1730
|
+
directions, including changes between two and three columns, so reused rows
|
|
1731
|
+
cannot show stale text or targets. Metric fields contain no new action target;
|
|
1732
|
+
Market badge, leading action, press, press-in, and long-press behavior remains
|
|
1733
|
+
owned by the existing Market row. Conformance requires validation and patch
|
|
1734
|
+
tests, native bind/reuse and action-anchor checks, then consuming App device
|
|
1735
|
+
checks at narrow and wide list widths. Source and unit tests alone do not
|
|
1736
|
+
establish native layout acceptance.
|
|
1737
|
+
|
|
1738
|
+
|
|
1511
1739
|
|
|
1512
1740
|
### Web grid fractional column geometry
|
|
1513
1741
|
|
|
@@ -114,8 +114,9 @@ final class NativeListActivityDetailsView: UIStackView {
|
|
|
114
114
|
let feeColumn = data.dictionary("fee") == nil ? 0 : gap + feeWidth
|
|
115
115
|
let identityWidth: CGFloat
|
|
116
116
|
if table {
|
|
117
|
-
let
|
|
118
|
-
|
|
117
|
+
let hasFee = data.dictionary("fee") != nil
|
|
118
|
+
let columnWidth = max(0, mainWidth - gap * (hasFee ? 2 : 1)) / (hasFee ? 2.6 : 2)
|
|
119
|
+
identityWidth = columnWidth - leadingWidth
|
|
119
120
|
} else {
|
|
120
121
|
identityWidth = mainWidth - leadingWidth - gap - feeColumn - min(amountsWidth, mainWidth * 0.5)
|
|
121
122
|
}
|
|
@@ -163,9 +164,17 @@ final class NativeListActivityDetailsView: UIStackView {
|
|
|
163
164
|
dimensions = [
|
|
164
165
|
visualWidth,
|
|
165
166
|
visual.heightAnchor.constraint(equalToConstant: CGFloat(image.double("height", default: 40))),
|
|
166
|
-
amounts.widthAnchor.constraint(lessThanOrEqualTo: main.widthAnchor, multiplier: table ? 0.42 : 0.5),
|
|
167
167
|
]
|
|
168
|
-
if table {
|
|
168
|
+
if table {
|
|
169
|
+
// The leading visual belongs to identity, so its visibility cannot shift amounts.
|
|
170
|
+
let leadingWidth = hideLeading ? 0 : CGFloat(image.double("width", default: 40)) + gap
|
|
171
|
+
dimensions.append(amounts.widthAnchor.constraint(equalTo: identity.widthAnchor, constant: leadingWidth))
|
|
172
|
+
if data.dictionary("fee") != nil {
|
|
173
|
+
dimensions.append(fee.widthAnchor.constraint(equalTo: amounts.widthAnchor, multiplier: 0.6))
|
|
174
|
+
}
|
|
175
|
+
} else {
|
|
176
|
+
dimensions.append(amounts.widthAnchor.constraint(lessThanOrEqualTo: main.widthAnchor, multiplier: 0.5))
|
|
177
|
+
}
|
|
169
178
|
NSLayoutConstraint.activate(dimensions)
|
|
170
179
|
visual.isHidden = hideLeading
|
|
171
180
|
if hideLeading {
|
|
@@ -91,7 +91,10 @@ final class NativeListIdentityCell: NativeListRendererCell {
|
|
|
91
91
|
let tertiary = NativeListResolvedText(
|
|
92
92
|
item.data.string("tertiary"), style: style.dictionary("tertiary"), size: 14,
|
|
93
93
|
color: .black, lineHeight: 20, lines: 1, fonts: fonts)
|
|
94
|
-
let
|
|
94
|
+
let titleImageSize = CGFloat(item.data.dictionary("titleImage")?.dictionary("image")?.double("width") ?? 0)
|
|
95
|
+
let titleImageWidth = titleImageSize > 0
|
|
96
|
+
? titleImageSize + 4 + (item.data.dictionary("titleIcon") == nil ? 0 : 24) : 0
|
|
97
|
+
let textHeight = max(titleImageSize, title.measure(width: max(1, textWidth - titleImageWidth)))
|
|
95
98
|
+ subtitle.measure(width: textWidth)
|
|
96
99
|
+ tertiary.measure(width: textWidth)
|
|
97
100
|
+ (item.data.string("subtitle").isEmpty ? 0 : CGFloat(style.double("lineGap", default: 0)))
|
|
@@ -107,6 +110,8 @@ final class NativeListIdentityCell: NativeListRendererCell {
|
|
|
107
110
|
private let titleRowStack = UIStackView()
|
|
108
111
|
private let titleLabel = NativeListTextLabel()
|
|
109
112
|
private let titleIconView = UIImageView()
|
|
113
|
+
private var titleImageSlot: NativeListImageSlot?
|
|
114
|
+
private var titleImageConstraints: [NSLayoutConstraint] = []
|
|
110
115
|
// Absorbs the title row's slack so the title keeps its intrinsic width and the
|
|
111
116
|
// title icon / badge follow the text (OK-66041); Android's PackedTitleLineLayout
|
|
112
117
|
// and the Web flex row already pack the title row at its start.
|
|
@@ -131,7 +136,7 @@ final class NativeListIdentityCell: NativeListRendererCell {
|
|
|
131
136
|
private var currentItem: NativeListItem?
|
|
132
137
|
private var currentTheme: [String: Any]?
|
|
133
138
|
private var leadingActionKey: String?
|
|
134
|
-
override var assetFields: [String] { ["leading"] }
|
|
139
|
+
override var assetFields: [String] { ["leading", "titleImage"] }
|
|
135
140
|
override var defaultSeparatorInset: CGFloat { 60 }
|
|
136
141
|
override var defaultCornerRadius: CGFloat {
|
|
137
142
|
guard let item = currentItem else { return 0 }
|
|
@@ -241,6 +246,11 @@ final class NativeListIdentityCell: NativeListRendererCell {
|
|
|
241
246
|
titleIconView.isHidden = true
|
|
242
247
|
titleIconView.accessibilityLabel = nil
|
|
243
248
|
titleIconView.isAccessibilityElement = false
|
|
249
|
+
titleImageSlot?.view.isHidden = true
|
|
250
|
+
titleImageSlot?.view.accessibilityLabel = nil
|
|
251
|
+
titleImageSlot?.view.isAccessibilityElement = false
|
|
252
|
+
NSLayoutConstraint.deactivate(titleImageConstraints)
|
|
253
|
+
titleImageConstraints = []
|
|
244
254
|
titleRowStack.setContentHuggingPriority(.defaultLow, for: .horizontal)
|
|
245
255
|
titleRowStack.setContentCompressionResistancePriority(.defaultHigh, for: .horizontal)
|
|
246
256
|
for label in [titleLabel, subtitleLabel, tertiaryLabel, badgeLabel] {
|
|
@@ -303,6 +313,38 @@ final class NativeListIdentityCell: NativeListRendererCell {
|
|
|
303
313
|
// title at `.required` the icon's 999 width constraint collapsed to 0.
|
|
304
314
|
titleLabel.setContentCompressionResistancePriority(.defaultHigh, for: .horizontal)
|
|
305
315
|
}
|
|
316
|
+
if let descriptor = item.data.dictionary("titleImage"),
|
|
317
|
+
let image = descriptor.dictionary("image"), !image.string("uri").isEmpty
|
|
318
|
+
{
|
|
319
|
+
let size = CGFloat(image.double("width"))
|
|
320
|
+
let slot = titleImageSlot ?? NativeListImageSlot()
|
|
321
|
+
titleImageSlot = slot
|
|
322
|
+
let view = slot.view
|
|
323
|
+
if view.superview == nil {
|
|
324
|
+
let index = titleRowStack.arrangedSubviews.firstIndex(of: titleIconView)! + 1
|
|
325
|
+
titleRowStack.insertArrangedSubview(view, at: index)
|
|
326
|
+
}
|
|
327
|
+
view.clipsToBounds = true
|
|
328
|
+
view.setContentHuggingPriority(.required, for: .horizontal)
|
|
329
|
+
view.setContentCompressionResistancePriority(.required, for: .horizontal)
|
|
330
|
+
view.translatesAutoresizingMaskIntoConstraints = false
|
|
331
|
+
view.layer.cornerRadius = size / 2
|
|
332
|
+
view.isHidden = false
|
|
333
|
+
let label = descriptor.string("accessibilityLabel")
|
|
334
|
+
view.accessibilityLabel = label.isEmpty ? nil : label
|
|
335
|
+
view.isAccessibilityElement = !label.isEmpty
|
|
336
|
+
titleImageConstraints = [
|
|
337
|
+
view.widthAnchor.constraint(equalToConstant: size),
|
|
338
|
+
view.heightAnchor.constraint(equalToConstant: size),
|
|
339
|
+
]
|
|
340
|
+
titleImageConstraints.forEach { $0.priority = UILayoutPriority(999) }
|
|
341
|
+
NSLayoutConstraint.activate(titleImageConstraints)
|
|
342
|
+
titleRowStack.setCustomSpacing(4, after: titleIconView.isHidden ? titleLabel : titleIconView)
|
|
343
|
+
titleLabel.setContentCompressionResistancePriority(.defaultHigh, for: .horizontal)
|
|
344
|
+
slot.bind(image, key: "\(item.key):titleImage", placeholder: "#00000000")
|
|
345
|
+
} else {
|
|
346
|
+
titleImageSlot?.recycle()
|
|
347
|
+
}
|
|
306
348
|
if let ratio = style["leadingContentMaxWidthRatio"] as? NSNumber,
|
|
307
349
|
root.arrangedSubviews.contains(visual)
|
|
308
350
|
{
|
|
@@ -339,7 +381,8 @@ final class NativeListIdentityCell: NativeListRendererCell {
|
|
|
339
381
|
} else {
|
|
340
382
|
titleRowStack.setCustomSpacing(
|
|
341
383
|
CGFloat(style.double("titleBadgeGap")),
|
|
342
|
-
after:
|
|
384
|
+
after: titleImageSlot?.view.isHidden == false ? titleImageSlot!.view
|
|
385
|
+
: titleIconView.isHidden ? titleLabel : titleIconView)
|
|
343
386
|
}
|
|
344
387
|
}
|
|
345
388
|
if style["trailingGap"] != nil { trailingStack.spacing = CGFloat(style.double("trailingGap")) }
|
|
@@ -413,6 +456,10 @@ final class NativeListIdentityCell: NativeListRendererCell {
|
|
|
413
456
|
}
|
|
414
457
|
override func recycleContent() {
|
|
415
458
|
visual.recycle()
|
|
459
|
+
titleImageSlot?.recycle()
|
|
460
|
+
titleImageSlot?.view.isHidden = true
|
|
461
|
+
titleImageSlot?.view.accessibilityLabel = nil
|
|
462
|
+
titleImageSlot?.view.isAccessibilityElement = false
|
|
416
463
|
trailingStack.reset()
|
|
417
464
|
currentItem = nil
|
|
418
465
|
}
|