@onekeyfe/react-native-native-list 6.7.0-alpha.475 → 6.8.0-10
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/README.md +312 -379
- package/android/src/main/java/com/onekey/nativelist/NativeListActivityDetailsView.kt +15 -6
- package/android/src/main/java/com/onekey/nativelist/NativeListIdentityRenderer.kt +3 -87
- package/android/src/main/java/com/onekey/nativelist/NativeListMediaPlaceholderView.kt +244 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListMediaTileRenderer.kt +32 -11
- package/android/src/main/java/com/onekey/nativelist/NativeListModels.kt +60 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListPrimitives.kt +3 -6
- package/android/src/main/java/com/onekey/nativelist/NativeListResolvedText.kt +5 -1
- package/android/src/main/java/com/onekey/nativelist/NativeListTextView.kt +75 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListView.kt +25 -19
- package/android/src/test/java/com/margelo/nitro/nativelist/NativeListDescriptionTouchPolicyTest.kt +153 -0
- package/docs/ROW_TEMPLATES.md +12 -12
- package/docs/SPEC.md +226 -110
- package/docs/STYLE_SPEC.md +7 -0
- package/ios/NativeListActivityDetailsView.swift +13 -5
- package/ios/NativeListIdentityRenderer.swift +6 -94
- package/ios/NativeListMediaPlaceholderView.swift +189 -0
- package/ios/NativeListMediaTileRenderer.swift +13 -13
- package/ios/NativeListResolvedText.swift +15 -4
- package/ios/NativeListTextLabel.swift +106 -0
- package/ios/RNCNativeListView.swift +129 -32
- package/ios/tests/NativeListActivityPresentationTests.swift +270 -0
- package/ios/tests/NativeListIdentityTitleIconLayoutTests.swift +0 -95
- package/ios/tests/NativeListLifecycleTests.swift +369 -40
- package/ios/tests/NativeListMediaVisibilityTests.swift +16 -7
- package/lib/module/NativeList.js +17 -4
- package/lib/module/NativeList.web.js +3 -1
- package/lib/module/models.js +0 -2
- package/lib/module/validation.js +54 -71
- package/lib/module/web/NativeListGeneratedIcons.js +1 -0
- package/lib/module/web/NativeListWebEngine.js +13 -11
- package/lib/module/web/templates/ActivityRowRenderer.js +29 -23
- package/lib/module/web/templates/DataRowRenderer.js +54 -1
- package/lib/module/web/templates/IdentityRowRenderer.js +3 -92
- package/lib/module/web/templates/MediaTileRowRenderer.js +84 -15
- package/lib/typescript/src/models.d.ts +19 -22
- package/package.json +1 -1
- package/scripts/generate-icons.test.mjs +1 -0
- package/scripts/native-list-icons.json +1 -1
- package/src/NativeList.tsx +25 -4
- package/src/NativeList.web.tsx +1 -1
- package/src/models.ts +18 -23
- package/src/validation.ts +89 -113
- package/src/web/NativeListGeneratedIcons.ts +1 -0
- package/src/web/NativeListWebEngine.ts +16 -11
- package/src/web/templates/ActivityRowRenderer.ts +42 -32
- package/src/web/templates/DataRowRenderer.ts +76 -1
- package/src/web/templates/IdentityRowRenderer.ts +3 -141
- package/src/web/templates/MediaTileRowRenderer.ts +90 -15
- package/android/src/main/java/com/onekey/nativelist/NativeListTitleSegmentLayout.kt +0 -49
- package/android/src/main/java/com/onekey/nativelist/NativeListTitleSegmentsView.kt +0 -105
- package/android/src/test/java/com/margelo/nitro/nativelist/NativeListTitleSegmentLayoutTest.kt +0 -80
- package/ios/NativeListTitleSegmentLayout.swift +0 -45
- package/ios/NativeListTitleSegmentsLabel.swift +0 -80
package/README.md
CHANGED
|
@@ -1,92 +1,108 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
|
|
1
3
|
# @onekeyfe/react-native-native-list
|
|
2
4
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
**Template-driven native lists for OneKey surfaces — UICollectionView on iOS, RecyclerView on Android and a windowed DOM engine on Web.**
|
|
6
|
+
|
|
7
|
+
[](https://www.npmjs.com/package/@onekeyfe/react-native-native-list)
|
|
8
|
+
[](LICENSE)
|
|
9
|
+

|
|
10
|
+

|
|
11
|
+

|
|
12
|
+

|
|
13
|
+
|
|
14
|
+
</div>
|
|
15
|
+
|
|
16
|
+
Renders bounded, high-volume row data without mounting a React subtree per row.
|
|
17
|
+
JavaScript sends one serializable snapshot — or an atomic batch of patches — to a
|
|
18
|
+
Nitro view, and the native host owns layout, recycling, selection, reorder and
|
|
19
|
+
scrolling. Rows are a strict discriminated union of thirteen fixed templates, so
|
|
20
|
+
there is no `renderItem`, arbitrary style dictionary or embedded React component
|
|
21
|
+
per cell. Web runs a separate windowed DOM engine behind the same component,
|
|
22
|
+
data model and imperative API.
|
|
23
|
+
|
|
24
|
+
## Features
|
|
25
|
+
|
|
26
|
+
- **No React subtree per row** — a snapshot or patch batch is serialized once,
|
|
27
|
+
and native collection hosts recycle cells.
|
|
28
|
+
- **Thirteen fixed row templates** — identity, wallet group, rail, activity,
|
|
29
|
+
message, data, market, media tile, metric card, section header, action, button
|
|
30
|
+
group and system rows cover the OneKey list surfaces.
|
|
31
|
+
- **Four layouts on one model** — `linear`, `sectioned`, `grid` and `table`,
|
|
32
|
+
with vertical/horizontal orientation, sticky headers, fixed footer, empty
|
|
33
|
+
state and named container slots.
|
|
34
|
+
- **Native interaction** — single/multiple selection with tri-state checkboxes,
|
|
35
|
+
reorder with a drag preview, a section index rail, pull to refresh and
|
|
36
|
+
end-reached events.
|
|
37
|
+
- **Imperative updates and scrolling** — apply snapshots/patches, reconcile
|
|
38
|
+
selection after native interaction, and scroll by key, index, item, offset or
|
|
39
|
+
location.
|
|
40
|
+
- **OneKeyImage-backed cells** — row image slots bind through
|
|
41
|
+
`@onekeyfe/react-native-image` reusable views and keep its shared cache
|
|
42
|
+
pipeline.
|
|
43
|
+
|
|
44
|
+
## Installation
|
|
45
|
+
|
|
46
|
+
```sh
|
|
47
|
+
yarn add @onekeyfe/react-native-native-list \
|
|
48
|
+
@onekeyfe/react-native-image \
|
|
49
|
+
@onekeyfe/react-native-native-logger \
|
|
50
|
+
react-native-nitro-modules@0.37.0
|
|
51
|
+
```
|
|
7
52
|
|
|
8
|
-
|
|
53
|
+
Peer dependencies: `react`, `react-native`, `react-native-nitro-modules`
|
|
54
|
+
0.37.0, `@onekeyfe/react-native-image` and `@onekeyfe/react-native-native-logger`.
|
|
55
|
+
Keep NativeList and OneKeyImage on the same release, because recycled image
|
|
56
|
+
slots use the image host's native view.
|
|
9
57
|
|
|
10
|
-
|
|
11
|
-
|
|
58
|
+
The package registers a native view, so install the app's iOS pods and rebuild
|
|
59
|
+
the native binary; a JavaScript-only install does not register it:
|
|
12
60
|
|
|
13
61
|
```sh
|
|
14
|
-
yarn add @onekeyfe/react-native-native-list@3.0.101 \
|
|
15
|
-
@onekeyfe/react-native-image@3.0.101 \
|
|
16
|
-
react-native-nitro-modules@0.37.0
|
|
17
62
|
cd ios && pod install
|
|
18
63
|
```
|
|
19
64
|
|
|
20
|
-
The package requires the React Native new
|
|
21
|
-
are iOS 15.5 and Android API 24.
|
|
65
|
+
Android links through autolinking. The package requires the React Native new
|
|
66
|
+
architecture; its deployment floors are iOS 15.5 and Android API 24.
|
|
22
67
|
|
|
23
|
-
##
|
|
68
|
+
## Usage
|
|
24
69
|
|
|
25
70
|
```tsx
|
|
26
|
-
import { useMemo
|
|
71
|
+
import { useMemo } from 'react';
|
|
27
72
|
import {
|
|
28
73
|
NativeList,
|
|
29
|
-
type NativeListRef,
|
|
30
74
|
type NativeListSnapshot,
|
|
31
|
-
type SelectionDeltaEvent,
|
|
32
75
|
} from '@onekeyfe/react-native-native-list';
|
|
33
76
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
width: 40,
|
|
57
|
-
height: 40,
|
|
58
|
-
contentFit: 'cover',
|
|
59
|
-
cachePolicy: 'memory-disk',
|
|
60
|
-
},
|
|
61
|
-
fallbackText: 'BT',
|
|
62
|
-
},
|
|
63
|
-
title: 'Bitcoin',
|
|
64
|
-
subtitle: 'BTC · Bitcoin',
|
|
65
|
-
trailing: [
|
|
66
|
-
{ kind: 'value', text: '$64,230' },
|
|
67
|
-
{ kind: 'checkbox', state: 'unchecked', target: { scope: 'row' } },
|
|
68
|
-
],
|
|
69
|
-
},
|
|
70
|
-
],
|
|
71
|
-
}),
|
|
72
|
-
[selectedKeys]
|
|
73
|
-
);
|
|
74
|
-
|
|
75
|
-
const handleSelection = (event: SelectionDeltaEvent) => {
|
|
76
|
-
setSelectedKeys((current) => {
|
|
77
|
-
const next = new Set(current);
|
|
78
|
-
event.removedKeys.forEach((key) => next.delete(key));
|
|
79
|
-
event.addedKeys.forEach((key) => next.add(key));
|
|
80
|
-
return [...next];
|
|
81
|
-
});
|
|
82
|
-
};
|
|
77
|
+
const snapshot: NativeListSnapshot = {
|
|
78
|
+
schemaVersion: 1,
|
|
79
|
+
generation: 1,
|
|
80
|
+
layout: { kind: 'sectioned', stickyHeaders: true, itemSpacing: 1 },
|
|
81
|
+
rows: [
|
|
82
|
+
{
|
|
83
|
+
type: 'sectionHeader',
|
|
84
|
+
key: 'assets',
|
|
85
|
+
sectionKey: 'assets',
|
|
86
|
+
title: 'Assets',
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
type: 'identity',
|
|
90
|
+
key: 'btc',
|
|
91
|
+
sectionKey: 'assets',
|
|
92
|
+
leading: { kind: 'icon', name: 'StarOutline' },
|
|
93
|
+
title: 'Bitcoin',
|
|
94
|
+
subtitle: 'BTC · Bitcoin',
|
|
95
|
+
trailing: [{ kind: 'value', text: '$64,230' }],
|
|
96
|
+
},
|
|
97
|
+
],
|
|
98
|
+
};
|
|
83
99
|
|
|
100
|
+
export function AssetList() {
|
|
101
|
+
const stableSnapshot = useMemo(() => snapshot, []);
|
|
84
102
|
return (
|
|
85
103
|
<NativeList
|
|
86
|
-
ref={listRef}
|
|
87
104
|
style={{ flex: 1 }}
|
|
88
|
-
snapshot={
|
|
89
|
-
onSelectionDelta={handleSelection}
|
|
105
|
+
snapshot={stableSnapshot}
|
|
90
106
|
onRowAction={({ rowKey, actionKey }) => {
|
|
91
107
|
console.log(rowKey, actionKey);
|
|
92
108
|
}}
|
|
@@ -95,83 +111,172 @@ export function AssetList() {
|
|
|
95
111
|
}
|
|
96
112
|
```
|
|
97
113
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
114
|
+
The application owns the snapshot and the React chrome around the list; the
|
|
115
|
+
native view owns cells, recycling and gestures. Keep the snapshot referentially
|
|
116
|
+
stable between unrelated renders — a re-render with an older snapshot
|
|
117
|
+
intentionally restores that older state.
|
|
118
|
+
|
|
119
|
+
## API
|
|
120
|
+
|
|
121
|
+
### Component
|
|
122
|
+
|
|
123
|
+
| Prop | Type | Platforms | Description |
|
|
124
|
+
| --- | --- | :-: | --- |
|
|
125
|
+
| `snapshot` | `NativeListSnapshot` | iOS, Android, Web | Required declarative baseline: layout, rows, theme, selection, capabilities. |
|
|
126
|
+
| `listHeader`, `listFooter`, `listEmpty` | `ReactNode` | iOS, Android, Web | Container slots outside the data-row stream. |
|
|
127
|
+
| `listExpandedContent`, `listStructureToggle` | `ReactNode` | iOS, Android, Web | Native disclosure content and its toggle. |
|
|
128
|
+
| `listSidecar`, `sidecarLayout` | `ReactNode`, `NativeListSidecarLayout` | iOS, Android, Web | Scrolling right column for a vertical linear list; both are required together. |
|
|
129
|
+
| `topOverlay`, `topScrollEdgeEffect` | `ReactNode`, `'hard' \| 'soft'` | iOS 26+ | Fixed overlay above scrolling rows and UIKit's top scroll-edge effect; both are required together. |
|
|
130
|
+
| `initialScrollIndex` / `initialScrollKey` | `number` / `string` | iOS, Android, Web | One-shot first position; the two props are mutually exclusive. |
|
|
131
|
+
| `initialScrollViewPosition`, `initialScrollViewOffset` | `number` | iOS, Android, Web | Offset applied to the initial scroll target. |
|
|
132
|
+
| `keyboardDismissMode` | `'none' \| 'on-drag' \| 'interactive'` | iOS, Android | `interactive` behaves as `none` on Android. |
|
|
133
|
+
| `keyboardShouldPersistTaps` | `'never' \| 'always' \| 'handled'` | iOS, Android | Defaults to `never`. |
|
|
134
|
+
| `webVirtualizationEnabled` | `boolean` | Web | Defaults to `true`. |
|
|
135
|
+
| `webScrollHost` | host object or `null` | Web | `undefined` owns scrolling; `null` waits for a host element. |
|
|
136
|
+
| `webStickyInset`, `webSectionIndexContainerRef` | `number`, `RefObject` | Web | Visible sticky chrome inset and the section-index host container. |
|
|
137
|
+
| `scrollPositionThresholds` | `{ start, end, enabled? }` | iOS, Android | Emits initial state and hysteresis transitions, not scroll frames. |
|
|
138
|
+
| `onRowAction`, `onActionAnchorInvalidated` | event callbacks | iOS, Android, Web | Row/accessory actions with anchor metadata, and anchor invalidation. |
|
|
139
|
+
| `onSelectionDelta`, `onReorder` | event callbacks | iOS, Android, Web | Native selection delta and committed reorder range. |
|
|
140
|
+
| `onEndReached`, `onVisibleRangeChanged` | event callbacks | iOS, Android, Web | End-reached fires once per snapshot `generation`; visible-range events are coalesced to one per display frame. |
|
|
141
|
+
| `onRefresh`, `onScrollToIndexFailed` | `() => void`, `(info) => void` | iOS, Android, Web | Pull-to-refresh request and invalid explicit scroll targets. |
|
|
142
|
+
| `onStructuralTransitionSettled` | event callback | iOS, Android | Settled/interrupted structural row animation. |
|
|
143
|
+
|
|
144
|
+
### Ref methods
|
|
145
|
+
|
|
146
|
+
All ref methods are available on iOS, Android and Web.
|
|
147
|
+
|
|
148
|
+
| Method | Description |
|
|
149
|
+
| --- | --- |
|
|
150
|
+
| `applySnapshot(snapshot)` | Replaces the declarative baseline. |
|
|
151
|
+
| `applyPatches(patches)` | Applies a validated, keyed patch batch atomically. |
|
|
152
|
+
| `reconcileSelection(keys)` | Replaces native selection without emitting a second delta. |
|
|
153
|
+
| `scrollToKey`, `scrollToIndex`, `scrollToItem` | Scroll to a row by stable key, index or row model. |
|
|
154
|
+
| `scrollToOffset`, `scrollToEnd`, `scrollToLocation` | Scroll by offset, to the end or to a section/item location. |
|
|
155
|
+
| `setActionAnchorState(state)` | Opens/closes an anchored action for a row control. |
|
|
156
|
+
| `setRefreshing(refreshing)` | Synchronizes the native refresh control. |
|
|
157
|
+
|
|
158
|
+
See [`src/NativeList.types.ts`](src/NativeList.types.ts) for the full prop, ref
|
|
159
|
+
and scroll-option types.
|
|
160
|
+
|
|
161
|
+
### Other exports
|
|
162
|
+
|
|
163
|
+
| Export | Platforms | Description |
|
|
164
|
+
| --- | :-: | --- |
|
|
165
|
+
| `preloadNativeListAvatarImages(sources)` | iOS, Android, Web | Preloads avatar `ImageSource`s through the OneKeyImage cache. |
|
|
166
|
+
| `configureNativeListFonts(families)` | iOS, Android, Web | Maps the regular/medium/semibold/bold faces for mounted lists at runtime. |
|
|
167
|
+
| `ScrollEdgeEffect` | iOS | `hard` / `soft` values for `topScrollEdgeEffect`. |
|
|
168
|
+
| `validateSnapshot`, `validatePatches` | iOS, Android, Web | Validate a snapshot or patch batch before use. |
|
|
169
|
+
| `applyRowPatches`, `planNativeListPatches` | iOS, Android, Web | Apply a patch batch to a snapshot, or plan value-only patches between two snapshots. |
|
|
170
|
+
| `serializeSnapshot`, `serializePatches` | iOS, Android, Web | Produce the JSON payloads the native host consumes. |
|
|
171
|
+
| `reduceSelection`, `isSelectableRow`, `checkboxStateForKeys`, `checkboxStateForSection`, `selectionStateFromSnapshot` | iOS, Android, Web | Selection state helpers shared with the application store. |
|
|
172
|
+
|
|
173
|
+
## Platform support
|
|
174
|
+
|
|
175
|
+
| Capability | iOS | Android | Web |
|
|
176
|
+
| --- | :-: | :-: | :-: |
|
|
177
|
+
| Snapshots, patches and the 13 row templates | ✅ | ✅ | ✅ |
|
|
178
|
+
| `linear`, `sectioned`, `grid` and `table` layouts | ✅ | ✅ | ✅ |
|
|
179
|
+
| Selection, row actions and tri-state checkboxes | ✅ | ✅ | ✅ |
|
|
180
|
+
| Reorder with a drag preview | ✅ | ✅ | ✅ |
|
|
181
|
+
| Section index rail | ✅ | ✅ | ✅ DOM overlay |
|
|
182
|
+
| Pull to refresh | ✅ | ✅ | ✅ |
|
|
183
|
+
| Container slots around the row stream | ✅ | ✅ | ✅ |
|
|
184
|
+
| Imperative scrolling and position thresholds | ✅ | ✅ | ✅ scrolling; — thresholds |
|
|
185
|
+
| Fixed top overlay / scroll-edge effect | ✅ iOS 26+ | — | — |
|
|
186
|
+
|
|
187
|
+
## Caveats
|
|
188
|
+
|
|
189
|
+
> [!IMPORTANT]
|
|
190
|
+
> Data rows are fixed templates. The public model rejects React children,
|
|
191
|
+
> per-row render functions, arbitrary style dictionaries, nested lists and
|
|
192
|
+
> unbounded self-sizing content. Use a named container slot for React chrome
|
|
193
|
+
> around the row stream.
|
|
194
|
+
|
|
195
|
+
> [!WARNING]
|
|
196
|
+
> `snapshot` is the declarative baseline. Re-rendering with an older snapshot
|
|
197
|
+
> after imperative patches or a reorder intentionally restores the older state;
|
|
198
|
+
> derive a new snapshot only when the data changes.
|
|
199
|
+
|
|
200
|
+
> [!NOTE]
|
|
201
|
+
> Web runs a windowed DOM engine behind the same component and data API. It
|
|
202
|
+
> mirrors the mobile data and imperative contracts, but its performance is
|
|
203
|
+
> independent of the native implementations and must be measured separately.
|
|
204
|
+
|
|
205
|
+
## References
|
|
206
|
+
|
|
207
|
+
- [Behavioral contract](docs/SPEC.md)
|
|
208
|
+
- [Row templates](docs/ROW_TEMPLATES.md)
|
|
209
|
+
- [Style vocabulary](docs/STYLE_SPEC.md)
|
|
210
|
+
- [Architecture and ownership](docs/DESIGN.md)
|
|
211
|
+
- [Example app page](../../example/react-native/pages/NativeListExamplePage.tsx)
|
|
212
|
+
- [npm package](https://www.npmjs.com/package/@onekeyfe/react-native-native-list)
|
|
213
|
+
- [Changelog](../../CHANGELOG.md)
|
|
214
|
+
|
|
215
|
+
## License
|
|
216
|
+
|
|
217
|
+
MIT. The avatar PRNG/HSL algorithms in `src/web/NativeListAvatarWorker.js` are
|
|
218
|
+
adapted from MyCrypto `ethereum-blockies-base64` (MIT); see [LICENSE](LICENSE).
|
|
102
219
|
|
|
103
220
|
## Row and layout model
|
|
104
221
|
|
|
105
|
-
`RowModel` is a strict discriminated union. It intentionally accepts no
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
|
112
|
-
|
|
|
113
|
-
| `
|
|
114
|
-
| `
|
|
115
|
-
| `
|
|
116
|
-
| `
|
|
117
|
-
| `
|
|
118
|
-
| `
|
|
119
|
-
| `
|
|
120
|
-
| `
|
|
121
|
-
| `
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
`
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
their metrics and progress remain bounded serializable data.
|
|
146
|
-
|
|
147
|
-
Set a section header's `variant` to `summary` for the fixed 56-point list
|
|
148
|
-
summary template. Its optional `valueActionKey` renders a 16-point secondary
|
|
149
|
-
action beside the 16-point medium primary title; summary headers do not accept
|
|
150
|
-
a checkbox and do not become sticky.
|
|
222
|
+
`RowModel` is a strict discriminated union. It intentionally accepts no React
|
|
223
|
+
element, render function, arbitrary style object or native object handle, so the
|
|
224
|
+
same snapshot can be validated and rendered on all three platforms.
|
|
225
|
+
|
|
226
|
+
### Row templates
|
|
227
|
+
|
|
228
|
+
| Row type | Intended template |
|
|
229
|
+
| --- | --- |
|
|
230
|
+
| `identity` | Asset, account, wallet, network or settings identity row |
|
|
231
|
+
| `walletGroup` | Parent and child wallet-sidebar identity rows in one group |
|
|
232
|
+
| `rail` | Compact horizontal item with optional native drag support |
|
|
233
|
+
| `activity` | Transaction/activity with amounts and up to three actions |
|
|
234
|
+
| `message` | Notification/message with bounded body lines and thumbnail |
|
|
235
|
+
| `dataRow` | Two to four fixed table columns, optional index/checkbox |
|
|
236
|
+
| `market` | Recycled token, stock or perpetual quote row |
|
|
237
|
+
| `mediaTile` | Gallery or browser-preview tile |
|
|
238
|
+
| `metricCard` | KPI or fixed Activity/Performance portfolio card |
|
|
239
|
+
| `sectionHeader` | Sticky/group, tri-state or fixed list-summary header |
|
|
240
|
+
| `action` | Fixed action row or fixed footer |
|
|
241
|
+
| `buttonGroup` | Bounded horizontal button row |
|
|
242
|
+
| `system` | Loading, retry, end marker or bounded spacer |
|
|
243
|
+
|
|
244
|
+
[docs/ROW_TEMPLATES.md](docs/ROW_TEMPLATES.md) defines every template with
|
|
245
|
+
structural illustrations, required fields, variants and styling boundaries.
|
|
246
|
+
|
|
247
|
+
### Layout kinds
|
|
248
|
+
|
|
249
|
+
- `linear` is a full-width row stream.
|
|
250
|
+
- `sectioned` gives section-header rows a native visual break and optional
|
|
251
|
+
pinning.
|
|
252
|
+
- `grid` uses two to seven native spans; structural rows span every column.
|
|
253
|
+
- `table` uses compact, alternating rows with stable weighted columns and column
|
|
254
|
+
alignment.
|
|
255
|
+
|
|
256
|
+
Vertical or horizontal orientation, stable keys, grouped card geometry, an empty
|
|
257
|
+
state and a fixed footer are common capabilities. The required theme tokens
|
|
258
|
+
cover list, row, selection, text, separator, accent and semantic
|
|
259
|
+
positive/negative colors; optional tokens let native templates match the OneKey
|
|
260
|
+
palette without embedding platform-specific style objects. Set a section
|
|
261
|
+
header's `variant` to `summary` for the fixed list-summary template.
|
|
151
262
|
|
|
152
263
|
For a native trailing section index, use a vertical `sectioned` layout, set
|
|
153
264
|
`capabilities.sectionIndex` to `{ enabled: true }`, and add an `indexTitle` to
|
|
154
265
|
each section header that should appear in the index. The index follows snapshot
|
|
155
|
-
order
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
The templates distribute and register no font files. Call
|
|
266
|
+
order and scrolls to the header's existing row `key`. Titles must be unique
|
|
267
|
+
after Unicode NFC normalization, contain no leading/trailing whitespace and stay
|
|
268
|
+
within eight Unicode code points. On Web the same entries render as a DOM
|
|
269
|
+
overlay with click and pointer-drag navigation.
|
|
270
|
+
|
|
271
|
+
### Fonts
|
|
272
|
+
|
|
273
|
+
Templates distribute and register no font files. Call
|
|
165
274
|
`configureNativeListFonts` once during UI-runtime startup, after the host loads
|
|
166
|
-
its fonts and before mounting lists
|
|
167
|
-
mapping; omitted faces and `{}` use system fonts. Mounted lists subscribe to
|
|
168
|
-
this runtime's mapping, with an independent native resolver per list. There is
|
|
169
|
-
no public per-list override and no cross-runtime native-global mapping.
|
|
275
|
+
its fonts and before mounting lists:
|
|
170
276
|
|
|
171
277
|
```tsx
|
|
172
278
|
import { configureNativeListFonts } from '@onekeyfe/react-native-native-list';
|
|
173
279
|
|
|
174
|
-
// After the host provisions/registers these faces, before mounting lists:
|
|
175
280
|
configureNativeListFonts({
|
|
176
281
|
regular: 'Roobert-Regular',
|
|
177
282
|
medium: 'Roobert-Medium',
|
|
@@ -180,89 +285,41 @@ configureNativeListFonts({
|
|
|
180
285
|
});
|
|
181
286
|
```
|
|
182
287
|
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
Names must be nonempty trimmed strings, at most 128 UTF-16 units without control
|
|
192
|
-
characters; invalid keys/values throw before changing any configuration. See
|
|
193
|
-
[SPEC.md](docs/SPEC.md) and [STYLE_SPEC.md](docs/STYLE_SPEC.md) for lifecycle,
|
|
194
|
-
system fallback and text-metric acceptance requirements. Their semantic icons and checkbox marks are
|
|
195
|
-
the same vector paths as the OneKey component
|
|
196
|
-
library, rendered by Core Graphics/UIKit on iOS and Canvas on Android.
|
|
288
|
+
The four optional faces replace the whole mapping; omitted faces and `{}` use
|
|
289
|
+
system fonts. On iOS these are registered PostScript names, on Android they are
|
|
290
|
+
React Native family keys or matching `fonts/<family>.ttf` host assets, and on Web
|
|
291
|
+
they are the host's CSS families. The host remains responsible for licensing and
|
|
292
|
+
provisioning. Changed mappings rebind text and invalidate list geometry without
|
|
293
|
+
replacing snapshots or selection; an active reorder is cancelled. Names must be
|
|
294
|
+
nonempty trimmed strings of at most 128 UTF-16 units without control
|
|
295
|
+
characters — invalid keys or values throw before any configuration changes.
|
|
197
296
|
|
|
198
297
|
### Market rows
|
|
199
298
|
|
|
200
|
-
`market` is a fixed native/DOM template, not a React `renderItem
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
zero runs can use `priceSegments`, `subtitleSegments`, or
|
|
299
|
+
`market` is a fixed native/DOM template, not a React `renderItem`; all displayed
|
|
300
|
+
values are already formatted strings. Its default token/perpetual geometry uses
|
|
301
|
+
a 32-point leading image with a 16-point network corner, while stock uses a
|
|
302
|
+
40-point image. Compact zero runs can use `priceSegments`, `subtitleSegments` or
|
|
205
303
|
`change.textSegments` with `{ style: 'subscript' }`.
|
|
206
304
|
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
title: 'BTC',
|
|
214
|
-
subtitle: '$1.23B',
|
|
215
|
-
price: '$64,230.00',
|
|
216
|
-
change: { text: '+2.40%', tone: 'positive' },
|
|
217
|
-
badges: [
|
|
218
|
-
{
|
|
219
|
-
key: 'community',
|
|
220
|
-
iconName: 'verified',
|
|
221
|
-
tone: 'success',
|
|
222
|
-
actionKey: 'market.communityInfo',
|
|
223
|
-
accessibilityLabel: 'Community recognized',
|
|
224
|
-
},
|
|
225
|
-
],
|
|
226
|
-
pressInActionKey: 'market.prewarm',
|
|
227
|
-
pressActionKey: 'market.open',
|
|
228
|
-
longPressActionKey: 'market.menu',
|
|
229
|
-
diagnostics: { imageBindActionKey: 'market.imageBind' },
|
|
230
|
-
} satisfies MarketRow;
|
|
231
|
-
```
|
|
232
|
-
|
|
233
|
-
Badges accept localized text, a bounded remote image, or the single built-in
|
|
234
|
-
`iconName: 'verified'` glyph. A badge `actionKey` emits independently with an
|
|
235
|
-
anchor whose source is `marketBadge`. Market long press fires after 800 ms and
|
|
236
|
-
is cancelled when the pointer moves more than 10 logical pixels or the list
|
|
237
|
-
scrolls. The optional diagnostic action fires when a row binds an image; quote-
|
|
238
|
-
only patches (`price`, `priceSegments`, `change`, `accessibilityLabel`, and
|
|
239
|
-
`revision`) update visible labels without rebinding that image.
|
|
305
|
+
Badges accept localized text, a bounded remote image or the built-in
|
|
306
|
+
`iconName: 'verified'` glyph, and a badge `actionKey` emits with an anchor whose
|
|
307
|
+
source is `marketBadge`. Market long press fires after 800 ms and is cancelled
|
|
308
|
+
when the pointer moves more than 10 logical pixels or the list scrolls.
|
|
309
|
+
Quote-only patches (`price`, `priceSegments`, `change`, `accessibilityLabel`,
|
|
310
|
+
`revision`) update visible labels without rebinding the image.
|
|
240
311
|
|
|
241
312
|
`style` is deliberately finite and uses the shared row-style vocabulary in
|
|
242
|
-
[docs/STYLE_SPEC.md](docs/STYLE_SPEC.md)
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
`
|
|
246
|
-
radius/content fit), `title`/`subtitle`/`price`/`change` text styles (`token`,
|
|
247
|
-
font size, weight, `#RRGGBB`/`#RRGGBBAA` color, line height, 1–3 `lines`,
|
|
248
|
-
`truncate`, alignment, vertical alignment and `offsetY`), the change block's
|
|
249
|
-
`changeWidth`/`changeHeight`/`changeCornerRadius`, and the common
|
|
250
|
-
`style.container` (explicit height, background, opacity, radius, border and
|
|
251
|
-
content alignment). Badge `style` accepts only `fontSize`, `fontWeight`,
|
|
252
|
-
`lineHeight`, `height` and `horizontalPadding`. Unknown keys at any level are
|
|
253
|
-
rejected by `validateSnapshot`/`validatePatches` rather than ignored. Omitting
|
|
254
|
-
`style` preserves the defaults. Loading, empty, retry,
|
|
255
|
-
and pagination states use the existing `system` rows with
|
|
256
|
-
`presentation: 'market'`. Loading rows accept `loadingStyle: 'skeleton'` for
|
|
257
|
-
the 56-point token skeleton or `'spinner'` for the centered 52-point pagination
|
|
258
|
-
indicator. Use `accessibilityLabel` for loading announcements. Omitting
|
|
259
|
-
`loadingStyle` preserves each platform's existing loading rendering.
|
|
313
|
+
[docs/STYLE_SPEC.md](docs/STYLE_SPEC.md); unknown keys at any level are rejected
|
|
314
|
+
by `validateSnapshot`/`validatePatches` rather than ignored. Loading, empty,
|
|
315
|
+
retry and pagination states use the existing `system` rows with
|
|
316
|
+
`presentation: 'market'`.
|
|
260
317
|
|
|
261
318
|
For native reorder, set `capabilities.reorderable` and mark eligible rail rows
|
|
262
319
|
with `draggable: true`, or add a `drag` trailing accessory to an identity row.
|
|
263
320
|
Reordering never crosses a `sectionKey` boundary.
|
|
264
321
|
|
|
265
|
-
|
|
322
|
+
### Images inside cells
|
|
266
323
|
|
|
267
324
|
Pass an `ImageSource` descriptor in the row model; do not pass a
|
|
268
325
|
`<OneKeyImage />` element:
|
|
@@ -283,187 +340,63 @@ const avatar = {
|
|
|
283
340
|
```
|
|
284
341
|
|
|
285
342
|
NativeList defaults `loadingStrategy` to `none`, so source-backed images render
|
|
286
|
-
without a loading background or terminal fallback
|
|
287
|
-
`skeleton` to opt into loading UI
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
The fixed slots cover token/network overlays, two activity visuals, a message
|
|
299
|
-
thumbnail, and stacks of two or three images. Image width and height are
|
|
300
|
-
required and bounded to 1–4096 logical pixels.
|
|
301
|
-
|
|
302
|
-
## Batch updates and events
|
|
303
|
-
|
|
304
|
-
```ts
|
|
305
|
-
listRef.current?.applyPatches([
|
|
306
|
-
{
|
|
307
|
-
type: 'identity',
|
|
308
|
-
key: 'btc',
|
|
309
|
-
changes: { revision: 2, subtitle: 'Updated in one native command' },
|
|
310
|
-
},
|
|
311
|
-
]);
|
|
312
|
-
|
|
313
|
-
listRef.current?.scrollToKey('btc', true, 'center');
|
|
314
|
-
listRef.current?.scrollToIndex({
|
|
315
|
-
index: 24,
|
|
316
|
-
animated: true,
|
|
317
|
-
viewPosition: 0.5,
|
|
318
|
-
viewOffset: 12,
|
|
319
|
-
});
|
|
320
|
-
listRef.current?.scrollToItem({ item: snapshot.rows[24] });
|
|
321
|
-
listRef.current?.scrollToOffset({ offset: 320, animated: false });
|
|
322
|
-
listRef.current?.scrollToEnd({ animated: true });
|
|
323
|
-
listRef.current?.scrollToLocation({ sectionIndex: 2, itemIndex: 4 });
|
|
324
|
-
listRef.current?.setRefreshing(false);
|
|
325
|
-
```
|
|
326
|
-
|
|
327
|
-
The ref exposes `applySnapshot`, `applyPatches`, `reconcileSelection`,
|
|
328
|
-
`scrollToKey`, `scrollToIndex`, `scrollToItem`, `scrollToOffset`, `scrollToEnd`,
|
|
329
|
-
`scrollToLocation`, and `setRefreshing`. The legacy
|
|
330
|
-
`scrollToIndex(index, animated, alignment)` and
|
|
331
|
-
`scrollToKey(key, animated, alignment)` signatures remain supported. Object
|
|
332
|
-
parameters follow React Native list semantics: `viewPosition` is from `0`
|
|
333
|
-
(start) through `1` (end), and a positive `viewOffset` leaves space before the
|
|
334
|
-
target row. Web, Android and iOS explicit position alignment also centers/ends
|
|
335
|
-
oversized rows; `nearest` preserves its legacy behavior. See [scrolling contract](docs/SPEC.md#explicit-scroll-alignment-ok-64041)
|
|
336
|
-
for platform status.
|
|
337
|
-
|
|
338
|
-
Use `initialScrollIndex` or the stable-key extension `initialScrollKey` to set
|
|
339
|
-
the first position. They are mutually exclusive, run once after the first
|
|
340
|
-
snapshot and native layout are ready, and can be combined with
|
|
341
|
-
`initialScrollViewPosition` and `initialScrollViewOffset`. Invalid index and
|
|
342
|
-
location requests call `onScrollToIndexFailed`; native lists do not fail merely
|
|
343
|
-
because a target row has not been mounted yet. `scrollToLocation` counts
|
|
344
|
-
non-summary section headers, then rows carrying that header's `sectionKey`.
|
|
343
|
+
without a loading background or terminal fallback; set it to `static` or
|
|
344
|
+
`skeleton` to opt into loading UI. Image width and height are required and
|
|
345
|
+
bounded to 1–4096 logical pixels. Each cell owns a fixed pool of reusable native
|
|
346
|
+
image slots covering token/network overlays, two activity visuals, a message
|
|
347
|
+
thumbnail and stacks of two or three images. On bind, NativeList forwards the
|
|
348
|
+
URI, headers, content fit, cache policy, autoplay, TOS options, overscan and
|
|
349
|
+
loading strategy, assigns a stable `rowKey:slot` recycling key, and keeps the
|
|
350
|
+
same SDWebImage (iOS) / Glide (Android) cache pipeline as
|
|
351
|
+
`@onekeyfe/react-native-image`.
|
|
352
|
+
|
|
353
|
+
### Patches, events and scrolling
|
|
345
354
|
|
|
346
355
|
Patches are validated as a batch, keyed by row key, must preserve the row
|
|
347
356
|
discriminator, and are applied atomically. Prefer a new snapshot for insertions,
|
|
348
|
-
removals, layout changes
|
|
357
|
+
removals, layout changes and section changes; use patches for frequently
|
|
349
358
|
changing fields.
|
|
350
359
|
|
|
351
|
-
|
|
352
|
-
`
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
| ------------------------- | ------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
382
|
-
| Environment | iPhone 16 Pro, iOS 18.6 | API 35 arm64, 1080 x 2400, fixed 60 Hz, non-debuggable Hermes |
|
|
383
|
-
| Page open, 5 runs | External tap-to-visible median 589 ms; the initial native visible-range callback did not emit | 5 / 5 native callbacks; mount-to-first-visible p50 110 ms; external observation p50 202 ms |
|
|
384
|
-
| Wallet switching | 202 / 202; mean 135.3 ms, p50 134 ms, p95 143 ms, max 159 ms | 202 / 202; mean 124.4 ms, p50 118 ms, p95 155 ms, max 213 ms |
|
|
385
|
-
| Account-list frame signal | 113.3 effective FPS; p50/p95 interval 6.67/18.33 ms; 6.6% over 17.5 ms | Repeated drag runs reported 92.09-93.06% deadline-missed frames and p50 450 ms |
|
|
386
|
-
| Wallet-list frame signal | 78.7 effective FPS; p50/p95 interval 13.33/20.00 ms; 17.8% over 17.5 ms | Down/up runs reported 89.39-100% deadline-missed frames and p50 400 ms |
|
|
387
|
-
| Process CPU | Wallet switching mean 48.9%; account scrolling mean 22.9% | Wallet switching mean 66.8%; account scrolling mean 67.1% on Android's per-core scale |
|
|
388
|
-
| Retained memory | Physical footprint 286 MB before, 275 MB after the first batch, 287 MB after the second; lifetime peak 335 MB | PSS 138,459 KiB with one wallet cached, 201,668 KiB after warming three wallets, 192,700 KiB after the second batch, 193,976 KiB after scrolling |
|
|
389
|
-
| Functional checks | Independent lists and fixed footer pass | Independent lists and fixed footer pass, including zero-difference stable screenshot crops |
|
|
390
|
-
|
|
391
|
-
Across the tested environments, Android Release is faster for page opening and
|
|
392
|
-
median wallet switching: external page-open p50 is 202 ms versus 589 ms on iOS,
|
|
393
|
-
and wallet-switch p50 is 118 ms versus 134 ms. iOS has the tighter switch tail
|
|
394
|
-
at p95 143 ms versus 155 ms, clearly leads both account-list and wallet-list
|
|
395
|
-
frame results, and uses less process CPU in the measured switch and scroll runs.
|
|
396
|
-
Both platforms pass correctness, independent scrolling, the fixed footer,
|
|
397
|
-
switch responsiveness, and the short-run retained-memory check. The current
|
|
398
|
-
cross-platform performance priority is Android continuous scrolling, followed
|
|
399
|
-
by the iOS wallet list's 120 Hz tail behavior.
|
|
400
|
-
|
|
401
|
-
### Test Suite source map
|
|
402
|
-
|
|
403
|
-
| Entry | OneKey application source |
|
|
404
|
-
| ------------------- | -------------------------------------------------------------------------------------------- |
|
|
405
|
-
| Linear container | `AssetList/components/TokenManager/TokenManagerList.tsx` |
|
|
406
|
-
| Sectioned container | `ChainSelector/components/AllNetworksManager/NetworksSectionList.tsx` |
|
|
407
|
-
| Grid container | `Home/components/NFTListView/index.tsx` |
|
|
408
|
-
| Table container | `Perp/components/TokenSelector/PerpTokenSelectorRow.tsx` |
|
|
409
|
-
| Identity rows | `Developer/pages/Gallery/Components/stories/ListItem.tsx` |
|
|
410
|
-
| Rail rows | `Perp/components/FavoritesBar/FavoriteTokenItem.tsx` |
|
|
411
|
-
| Activity rows | `components/TxHistoryListView/TxHistoryListItem.tsx` |
|
|
412
|
-
| Message rows | `Notifications/components/NotificationListView.tsx` |
|
|
413
|
-
| Data rows | `Perp/components/TokenSelector/PerpTokenSelectorRow.tsx` |
|
|
414
|
-
| Media tile rows | `Home/components/NFTListView/NFTListItem.tsx` |
|
|
415
|
-
| Metric card rows | `Perp/components/Portfolio/PerpPortfolioContent.tsx` |
|
|
416
|
-
| Section header rows | `AllNetworksManager/NetworksSectionList.tsx`, `TxHistoryListView/TxHistorySectionHeader.tsx` |
|
|
417
|
-
| Action rows | `TokenManager/TokenManagerList.tsx`, `Discovery/pages/BookmarkListModal/index.tsx` |
|
|
418
|
-
| System rows | `components/Loading/ListLoading.tsx`, `TokenListView/CrossNetworkSearchRows.tsx` |
|
|
419
|
-
| Checkbox selection | `components/forms/Checkbox/index.tsx`, `AllNetworksManager/NetworksSectionList.tsx` |
|
|
420
|
-
|
|
421
|
-
The checkbox page exercises list, section, and row targets plus checked,
|
|
422
|
-
unchecked, indeterminate, loading, and disabled presentation. The rail page
|
|
423
|
-
keeps horizontal selection and native reorder isolated from the other pages.
|
|
424
|
-
|
|
425
|
-
Measure a release build on a physical device. Run each scenario at least three
|
|
426
|
-
times, record cold and warm first-visible latency, JS batch-dispatch latency,
|
|
427
|
-
UI-thread frame time/dropped frames, and peak memory. During repeated fast
|
|
428
|
-
scrolls verify that no stale image from a recycled row becomes visible. The
|
|
429
|
-
benchmark page reports deterministic JS timings and visible-range milestones;
|
|
430
|
-
use Instruments or Android Studio Profiler for native frame and memory data.
|
|
431
|
-
|
|
432
|
-
## Limits
|
|
433
|
-
|
|
434
|
-
- Nitro View/new architecture only; no Paper component.
|
|
435
|
-
- Fixed templates only. Arbitrary children, per-row render functions, and
|
|
436
|
-
arbitrary style dictionaries are rejected by the public model.
|
|
437
|
-
- Template heights and text line counts are bounded. There is no unbounded
|
|
438
|
-
self-sizing content, nested list, or React component embedded in a cell.
|
|
439
|
-
- A snapshot prop is the declarative baseline. Re-rendering with an older
|
|
440
|
-
snapshot after imperative patches or reorder will intentionally restore the
|
|
441
|
-
older state.
|
|
442
|
-
- The web implementation uses a pure DOM, windowed, recycled row engine behind
|
|
443
|
-
the React component. It mirrors the mobile data and imperative APIs, but its
|
|
444
|
-
performance must still be measured independently from iOS and Android.
|
|
445
|
-
|
|
446
|
-
Start with [docs/SPEC.md](docs/SPEC.md) for the behavioral contract and migration
|
|
447
|
-
status. See [docs/DESIGN.md](docs/DESIGN.md) for the architecture and ownership model, and
|
|
448
|
-
[docs/STYLE_SPEC.md](docs/STYLE_SPEC.md) for the shared style vocabulary: design
|
|
449
|
-
tokens, local layout-safety rules, common list capabilities and current implementation
|
|
450
|
-
gaps. [docs/ROW_TEMPLATES.md](docs/ROW_TEMPLATES.md) defines all 12 row types with
|
|
451
|
-
structural illustrations, required fields, variants and styling boundaries.
|
|
360
|
+
`applyPatches` applies a validated batch to the current snapshot;
|
|
361
|
+
`reconcileSelection` replaces native selection without emitting a second delta. Object scroll parameters follow
|
|
362
|
+
React Native list semantics: `viewPosition` runs from `0` (start) through `1`
|
|
363
|
+
(end), and a positive `viewOffset` leaves space before the target row. Explicit
|
|
364
|
+
position alignment also centers/ends oversized rows on all three platforms.
|
|
365
|
+
`initialScrollIndex` or the stable-key extension `initialScrollKey` sets the
|
|
366
|
+
first position once, after the first snapshot and native layout are ready, and
|
|
367
|
+
can be combined with `initialScrollViewPosition` and
|
|
368
|
+
`initialScrollViewOffset`. `scrollToLocation` counts non-summary section headers,
|
|
369
|
+
then rows carrying that header's `sectionKey`. Invalid index and location
|
|
370
|
+
requests call `onScrollToIndexFailed`; native lists do not fail merely because a
|
|
371
|
+
target row has not been mounted yet.
|
|
372
|
+
|
|
373
|
+
### Example app and native checks
|
|
374
|
+
|
|
375
|
+
The React Native example application contains a categorized native-list entry
|
|
376
|
+
page, a reproducible benchmark page, and an account-selector stress page
|
|
377
|
+
(1,000 wallets × 1,000 accounts) that materializes only the selected wallet's
|
|
378
|
+
rows.
|
|
379
|
+
|
|
380
|
+
- [Native list entry page](../../example/react-native/pages/NativeListExamplePage.tsx)
|
|
381
|
+
- [Row style page](../../example/react-native/pages/NativeListRowStylePage.tsx)
|
|
382
|
+
- [Benchmark page](../../example/react-native/pages/NativeListBenchmarkPage.tsx)
|
|
383
|
+
- [Account selector page](../../example/react-native/pages/NativeListAccountSelectorPage.tsx)
|
|
384
|
+
|
|
385
|
+
Swift geometry regressions compile the shipping helper directly:
|
|
386
|
+
|
|
387
|
+
```sh
|
|
388
|
+
swift test --package-path tests/swiftpm
|
|
389
|
+
```
|
|
452
390
|
|
|
453
|
-
|
|
391
|
+
The Android scroll-alignment suite runs against the package's Kotlin helper in a
|
|
392
|
+
configured consumer project:
|
|
454
393
|
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
394
|
+
```sh
|
|
395
|
+
./gradlew :onekeyfe_react-native-native-list:testDebugUnitTest \
|
|
396
|
+
--tests com.margelo.nitro.nativelist.NativeListScrollAlignmentTest
|
|
397
|
+
```
|
|
459
398
|
|
|
460
|
-
|
|
461
|
-
Swift geometry regression suite. Its source symlink compiles the shipping
|
|
462
|
-
helper directly. These are geometry unit tests, not RecyclerView/UICollectionView
|
|
463
|
-
integration tests. Full-app visibility, unmounted/deferred behavior and
|
|
399
|
+
Both are geometry unit tests. Full-app visibility, deferred behavior and
|
|
464
400
|
consumer-owned layout/input cancellation require separate runtime validation;
|
|
465
|
-
see [
|
|
466
|
-
|
|
467
|
-
`webSectionIndexContainerRef` uses the actual View instance type through
|
|
468
|
-
`React.ElementRef<typeof View>`. RN 0.86.2/0.88.0 declaration checks preserve its
|
|
469
|
-
existing nullable ref API without a consumer declaration patch.
|
|
401
|
+
see [docs/SPEC.md](docs/SPEC.md). [docs/DESIGN.md](docs/DESIGN.md) documents the
|
|
402
|
+
architecture and ownership model.
|