@onekeyfe/react-native-native-list 6.7.0-alpha.344 → 6.7.0-alpha.359
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/HybridNativeList.kt +7 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListAccessoryStack.kt +240 -7
- package/android/src/main/java/com/onekey/nativelist/NativeListActivityDetailsView.kt +7 -4
- package/android/src/main/java/com/onekey/nativelist/NativeListActivityRenderer.kt +6 -3
- package/android/src/main/java/com/onekey/nativelist/NativeListButtonGroupRenderer.kt +102 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListContainerSlotAdapter.kt +12 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListDataRowRenderer.kt +87 -7
- package/android/src/main/java/com/onekey/nativelist/NativeListIdentityRenderer.kt +135 -1
- package/android/src/main/java/com/onekey/nativelist/NativeListLeadingVisual.kt +43 -14
- package/android/src/main/java/com/onekey/nativelist/NativeListMessageRenderer.kt +25 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListModels.kt +17 -2
- package/android/src/main/java/com/onekey/nativelist/NativeListPrimitives.kt +22 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListRendererRegistry.kt +2 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListRendererRowView.kt +2 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListResolvedText.kt +3 -2
- package/android/src/main/java/com/onekey/nativelist/NativeListSectionHeaderRenderer.kt +69 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListTextView.kt +55 -1
- package/android/src/main/java/com/onekey/nativelist/NativeListView.kt +585 -21
- package/android/src/test/java/com/margelo/nitro/nativelist/NativeListPressPolicyTest.kt +1 -0
- package/docs/ROW_TEMPLATES.md +60 -9
- package/docs/SPEC.md +361 -8
- package/docs/STYLE_SPEC.md +6 -0
- package/ios/HybridNativeList.swift +10 -0
- package/ios/NativeListAccessoryStack.swift +220 -37
- package/ios/NativeListActivityDetailsView.swift +18 -8
- package/ios/NativeListActivityRenderer.swift +8 -2
- package/ios/NativeListButtonGroupRenderer.swift +89 -0
- package/ios/NativeListDataRowRenderer.swift +128 -16
- package/ios/NativeListDesignAssets.swift +3 -0
- package/ios/NativeListIdentityRenderer.swift +123 -5
- package/ios/NativeListLeadingVisual.swift +49 -14
- package/ios/NativeListMessageRenderer.swift +34 -1
- package/ios/NativeListModels.swift +16 -2
- package/ios/NativeListRendererRegistry.swift +1 -0
- package/ios/NativeListResolvedText.swift +2 -1
- package/ios/NativeListRowHost.swift +14 -0
- package/ios/NativeListSectionHeaderRenderer.swift +88 -0
- package/ios/RNCNativeListView.swift +335 -29
- package/ios/Resources/NativeListIcons.xcassets/onekey_crypto_coin_outline.imageset/Contents.json +15 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_crypto_coin_outline.imageset/icon.svg +4 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_gas_solid.imageset/Contents.json +15 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_gas_solid.imageset/icon.svg +3 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_refresh_ccw_outline.imageset/Contents.json +15 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_refresh_ccw_outline.imageset/icon.svg +3 -0
- package/ios/tests/NativeListActivityPresentationTests.swift +56 -0
- package/ios/tests/NativeListLifecycleTests.swift +1283 -3
- package/lib/module/NativeList.js +64 -27
- package/lib/module/NativeList.web.js +84 -17
- package/lib/module/models.js +1 -0
- package/lib/module/selection.js +1 -1
- package/lib/module/validation.js +532 -18
- package/lib/module/web/NativeListWebEngine.js +391 -24
- package/lib/module/web/templates/ActivityRowRenderer.js +8 -7
- package/lib/module/web/templates/ButtonGroupRowRenderer.js +47 -0
- package/lib/module/web/templates/DataRowRenderer.js +40 -5
- package/lib/module/web/templates/IdentityRowRenderer.js +90 -4
- package/lib/module/web/templates/MessageRowRenderer.js +18 -2
- package/lib/module/web/templates/RowContainerStyle.js +1 -0
- package/lib/module/web/templates/RowRendererRegistry.js +3 -0
- package/lib/module/web/templates/SectionHeaderRowRenderer.js +36 -2
- package/lib/nitrogen/generated/android/c++/JHybridNativeListSpec.cpp +9 -0
- package/lib/nitrogen/generated/android/c++/JHybridNativeListSpec.hpp +2 -0
- package/lib/nitrogen/generated/android/c++/views/JHybridNativeListStateUpdater.cpp +5 -0
- package/lib/nitrogen/generated/android/kotlin/com/margelo/nitro/nativelist/HybridNativeListSpec.kt +6 -0
- package/lib/nitrogen/generated/ios/c++/HybridNativeListSpecSwift.hpp +7 -0
- package/lib/nitrogen/generated/ios/c++/views/HybridNativeListComponent.mm +6 -0
- package/lib/nitrogen/generated/ios/swift/HybridNativeListSpec.swift +1 -0
- package/lib/nitrogen/generated/ios/swift/HybridNativeListSpec_cxx.swift +11 -0
- package/lib/nitrogen/generated/shared/c++/HybridNativeListSpec.cpp +2 -0
- package/lib/nitrogen/generated/shared/c++/HybridNativeListSpec.hpp +2 -0
- package/lib/nitrogen/generated/shared/c++/views/HybridNativeListComponent.cpp +2 -0
- package/lib/nitrogen/generated/shared/c++/views/HybridNativeListComponent.hpp +3 -0
- package/lib/nitrogen/generated/shared/json/NativeListConfig.json +1 -0
- package/lib/typescript/src/NativeList.d.ts +2 -2
- package/lib/typescript/src/NativeList.nitro.d.ts +1 -0
- package/lib/typescript/src/NativeList.types.d.ts +8 -0
- package/lib/typescript/src/models.d.ts +101 -9
- package/lib/typescript/src/validation.d.ts +13 -0
- package/lib/typescript/src/web/NativeListWebEngine.d.ts +26 -0
- package/lib/typescript/src/web/templates/ButtonGroupRowRenderer.d.ts +14 -0
- package/lib/typescript/src/web/templates/IdentityRowRenderer.d.ts +1 -1
- package/lib/typescript/src/web/templates/MessageRowRenderer.d.ts +9 -3
- package/nitrogen/generated/android/c++/JHybridNativeListSpec.cpp +9 -0
- package/nitrogen/generated/android/c++/JHybridNativeListSpec.hpp +2 -0
- package/nitrogen/generated/android/c++/views/JHybridNativeListStateUpdater.cpp +5 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nativelist/HybridNativeListSpec.kt +6 -0
- package/nitrogen/generated/ios/c++/HybridNativeListSpecSwift.hpp +7 -0
- package/nitrogen/generated/ios/c++/views/HybridNativeListComponent.mm +6 -0
- package/nitrogen/generated/ios/swift/HybridNativeListSpec.swift +1 -0
- package/nitrogen/generated/ios/swift/HybridNativeListSpec_cxx.swift +11 -0
- package/nitrogen/generated/shared/c++/HybridNativeListSpec.cpp +2 -0
- package/nitrogen/generated/shared/c++/HybridNativeListSpec.hpp +2 -0
- package/nitrogen/generated/shared/c++/views/HybridNativeListComponent.cpp +2 -0
- package/nitrogen/generated/shared/c++/views/HybridNativeListComponent.hpp +3 -0
- package/nitrogen/generated/shared/json/NativeListConfig.json +1 -0
- package/package.json +3 -3
- package/react-native-native-list.podspec +1 -0
- package/src/NativeList.nitro.ts +1 -0
- package/src/NativeList.tsx +155 -69
- package/src/NativeList.types.ts +9 -0
- package/src/NativeList.web.tsx +159 -49
- package/src/models.ts +113 -3
- package/src/selection.ts +1 -0
- package/src/validation.ts +1156 -18
- package/src/web/NativeListWebEngine.ts +594 -28
- package/src/web/templates/ActivityRowRenderer.ts +14 -6
- package/src/web/templates/ButtonGroupRowRenderer.ts +58 -0
- package/src/web/templates/DataRowRenderer.ts +93 -20
- package/src/web/templates/IdentityRowRenderer.ts +150 -5
- package/src/web/templates/MessageRowRenderer.ts +23 -7
- package/src/web/templates/RowContainerStyle.ts +2 -0
- package/src/web/templates/RowRendererRegistry.ts +11 -1
- package/src/web/templates/SectionHeaderRowRenderer.ts +47 -4
package/src/NativeList.web.tsx
CHANGED
|
@@ -21,7 +21,13 @@ import {
|
|
|
21
21
|
validateOffset,
|
|
22
22
|
type NormalizedPositionScroll,
|
|
23
23
|
} from './scrolling';
|
|
24
|
-
import {
|
|
24
|
+
import {
|
|
25
|
+
applyRowPatches,
|
|
26
|
+
containNativeListInput,
|
|
27
|
+
emptyNativeListSnapshot,
|
|
28
|
+
validatePatches,
|
|
29
|
+
validateSnapshot,
|
|
30
|
+
} from './validation';
|
|
25
31
|
import {
|
|
26
32
|
NativeListWebEngine,
|
|
27
33
|
type NativeListWebCallbacks,
|
|
@@ -83,14 +89,16 @@ export function preloadNativeListAvatarImages(
|
|
|
83
89
|
export const NativeList = forwardRef<NativeListRef, NativeListProps>(
|
|
84
90
|
function NativeList(
|
|
85
91
|
{
|
|
86
|
-
snapshot,
|
|
92
|
+
snapshot: inputSnapshot,
|
|
87
93
|
listHeader,
|
|
88
94
|
listEmpty,
|
|
89
95
|
listFooter,
|
|
96
|
+
listSidecar,
|
|
97
|
+
sidecarLayout,
|
|
90
98
|
topOverlay: _topOverlay,
|
|
91
99
|
topScrollEdgeEffect: _topScrollEdgeEffect,
|
|
92
100
|
webScrollHost,
|
|
93
|
-
webStickyInset = 0,
|
|
101
|
+
webStickyInset: inputStickyInset = 0,
|
|
94
102
|
scrollPositionThresholds: _scrollPositionThresholds,
|
|
95
103
|
onScrollPositionThresholdChange: _onScrollPositionThresholdChange,
|
|
96
104
|
webVirtualizationEnabled = true,
|
|
@@ -113,6 +121,24 @@ export const NativeList = forwardRef<NativeListRef, NativeListProps>(
|
|
|
113
121
|
},
|
|
114
122
|
forwardedRef
|
|
115
123
|
) {
|
|
124
|
+
const acceptedSnapshotRef = useRef<NativeListSnapshot>(
|
|
125
|
+
emptyNativeListSnapshot()
|
|
126
|
+
);
|
|
127
|
+
const initializedSnapshot = useRef(false);
|
|
128
|
+
const webStickyInset = useMemo(
|
|
129
|
+
() =>
|
|
130
|
+
containNativeListInput(() => {
|
|
131
|
+
if (!Number.isFinite(inputStickyInset) || inputStickyInset < 0)
|
|
132
|
+
throw new Error('webStickyInset must be finite and non-negative');
|
|
133
|
+
return inputStickyInset;
|
|
134
|
+
}) ?? 0,
|
|
135
|
+
[inputStickyInset]
|
|
136
|
+
);
|
|
137
|
+
const preparedSnapshot = useMemo(
|
|
138
|
+
() => containNativeListInput(() => validateSnapshot(inputSnapshot)),
|
|
139
|
+
[inputSnapshot]
|
|
140
|
+
);
|
|
141
|
+
const snapshot = preparedSnapshot ?? acceptedSnapshotRef.current;
|
|
116
142
|
const fontFamiliesJson = useNativeListFontFamiliesJson();
|
|
117
143
|
const fontFamiliesJsonRef = useRef(fontFamiliesJson);
|
|
118
144
|
fontFamiliesJsonRef.current = fontFamiliesJson;
|
|
@@ -132,6 +158,8 @@ export const NativeList = forwardRef<NativeListRef, NativeListProps>(
|
|
|
132
158
|
snapshot.layout.contentPadding ??
|
|
133
159
|
0,
|
|
134
160
|
}));
|
|
161
|
+
const [viewportWidth, setViewportWidth] = useState(0);
|
|
162
|
+
const [sidecarHeight, setSidecarHeight] = useState(0);
|
|
135
163
|
const synchronizeSlots = (next: NativeListSnapshot) => {
|
|
136
164
|
const hasRows = next.rows.length > 0;
|
|
137
165
|
const padding =
|
|
@@ -181,6 +209,7 @@ export const NativeList = forwardRef<NativeListRef, NativeListProps>(
|
|
|
181
209
|
listHeader !== undefined ||
|
|
182
210
|
listEmpty !== undefined ||
|
|
183
211
|
listFooter !== undefined;
|
|
212
|
+
useSlotLayoutRef.current ||= listSidecar !== undefined;
|
|
184
213
|
const useSlotLayout = useSlotLayoutRef.current;
|
|
185
214
|
const resolvedScrollHost =
|
|
186
215
|
webScrollHost === undefined
|
|
@@ -188,14 +217,32 @@ export const NativeList = forwardRef<NativeListRef, NativeListProps>(
|
|
|
188
217
|
? ownedScrollHost
|
|
189
218
|
: undefined
|
|
190
219
|
: webScrollHost;
|
|
191
|
-
if (!Number.isFinite(webStickyInset) || webStickyInset < 0)
|
|
192
|
-
throw new Error('webStickyInset must be finite and non-negative');
|
|
193
220
|
const engineRef = useRef<NativeListWebEngine | undefined>(undefined);
|
|
194
221
|
const webVirtualizationEnabledRef = useRef(webVirtualizationEnabled);
|
|
195
222
|
webVirtualizationEnabledRef.current = webVirtualizationEnabled;
|
|
196
223
|
const validatedSnapshot = useMemo(
|
|
197
|
-
() =>
|
|
198
|
-
|
|
224
|
+
() =>
|
|
225
|
+
containNativeListInput(() => {
|
|
226
|
+
if ((listSidecar !== undefined) !== (sidecarLayout !== undefined))
|
|
227
|
+
throw new Error(
|
|
228
|
+
'listSidecar and sidecarLayout must be supplied together'
|
|
229
|
+
);
|
|
230
|
+
if (sidecarLayout) {
|
|
231
|
+
const { width, gap, maxContentWidth } = sidecarLayout;
|
|
232
|
+
if (
|
|
233
|
+
snapshot.layout.kind !== 'linear' ||
|
|
234
|
+
!Number.isFinite(width) ||
|
|
235
|
+
width <= 0 ||
|
|
236
|
+
!Number.isFinite(gap) ||
|
|
237
|
+
gap < 0 ||
|
|
238
|
+
!Number.isFinite(maxContentWidth) ||
|
|
239
|
+
maxContentWidth <= width + gap
|
|
240
|
+
)
|
|
241
|
+
throw new Error('Invalid NativeList sidecar layout');
|
|
242
|
+
}
|
|
243
|
+
return normalizeWebSnapshot(snapshot, hasEmptySlot, useSlotLayout);
|
|
244
|
+
}) ?? acceptedSnapshotRef.current,
|
|
245
|
+
[snapshot, hasEmptySlot, useSlotLayout, listSidecar, sidecarLayout]
|
|
199
246
|
);
|
|
200
247
|
const snapshotRef = useRef(validatedSnapshot);
|
|
201
248
|
const snapshotPropRef = useRef(validatedSnapshot);
|
|
@@ -203,8 +250,13 @@ export const NativeList = forwardRef<NativeListRef, NativeListProps>(
|
|
|
203
250
|
if (snapshotPropRef.current !== validatedSnapshot) {
|
|
204
251
|
snapshotPropRef.current = validatedSnapshot;
|
|
205
252
|
snapshotRef.current = validatedSnapshot;
|
|
253
|
+
acceptedSnapshotRef.current = validatedSnapshot;
|
|
206
254
|
synchronizeSlots(snapshot);
|
|
207
255
|
}
|
|
256
|
+
if (!initializedSnapshot.current) {
|
|
257
|
+
acceptedSnapshotRef.current = validatedSnapshot;
|
|
258
|
+
initializedSnapshot.current = true;
|
|
259
|
+
}
|
|
208
260
|
const appliedSnapshotRef = useRef<NativeListSnapshot | undefined>(
|
|
209
261
|
undefined
|
|
210
262
|
);
|
|
@@ -227,26 +279,28 @@ export const NativeList = forwardRef<NativeListRef, NativeListProps>(
|
|
|
227
279
|
}>
|
|
228
280
|
| undefined
|
|
229
281
|
>(
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
282
|
+
containNativeListInput(() =>
|
|
283
|
+
initialScrollIndex === undefined && initialScrollKey === undefined
|
|
284
|
+
? undefined
|
|
285
|
+
: initialScrollIndex !== undefined
|
|
286
|
+
? normalizeIndexScroll({
|
|
287
|
+
index: initialScrollIndex,
|
|
288
|
+
animated: false,
|
|
289
|
+
viewPosition: initialScrollViewPosition,
|
|
290
|
+
viewOffset: initialScrollViewOffset,
|
|
291
|
+
})
|
|
292
|
+
: {
|
|
293
|
+
key: initialScrollKey,
|
|
294
|
+
scroll: normalizePositionScroll(
|
|
295
|
+
{
|
|
296
|
+
animated: false,
|
|
297
|
+
viewPosition: initialScrollViewPosition,
|
|
298
|
+
viewOffset: initialScrollViewOffset,
|
|
299
|
+
},
|
|
300
|
+
'start'
|
|
301
|
+
),
|
|
302
|
+
}
|
|
303
|
+
)
|
|
250
304
|
);
|
|
251
305
|
const didApplyInitialScroll = useRef(false);
|
|
252
306
|
const scrollOptionsRef = useRef({
|
|
@@ -265,19 +319,23 @@ export const NativeList = forwardRef<NativeListRef, NativeListProps>(
|
|
|
265
319
|
(useSlotLayout && !contentBounds)
|
|
266
320
|
)
|
|
267
321
|
return;
|
|
268
|
-
const engine =
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
322
|
+
const engine = containNativeListInput(
|
|
323
|
+
() =>
|
|
324
|
+
new NativeListWebEngine(
|
|
325
|
+
host,
|
|
326
|
+
snapshotRef.current,
|
|
327
|
+
callbacksRef.current,
|
|
328
|
+
webVirtualizationEnabledRef.current,
|
|
329
|
+
webSectionIndexContainerRef?.current as unknown as HTMLElement | null,
|
|
330
|
+
fontFamiliesJsonRef.current,
|
|
331
|
+
{
|
|
332
|
+
scrollHost: resolvedScrollHost as HTMLElement | undefined,
|
|
333
|
+
contentBounds: contentBounds ?? undefined,
|
|
334
|
+
...scrollOptionsRef.current,
|
|
335
|
+
}
|
|
336
|
+
)
|
|
280
337
|
);
|
|
338
|
+
if (!engine) return;
|
|
281
339
|
host.style.height = '';
|
|
282
340
|
engineRef.current = engine;
|
|
283
341
|
appliedSnapshotRef.current = snapshotRef.current;
|
|
@@ -337,20 +395,30 @@ export const NativeList = forwardRef<NativeListRef, NativeListProps>(
|
|
|
337
395
|
|
|
338
396
|
useImperativeHandle(forwardedRef, () => ({
|
|
339
397
|
applySnapshot(nextSnapshot) {
|
|
340
|
-
const next =
|
|
398
|
+
const next = containNativeListInput(() =>
|
|
399
|
+
normalizeWebSnapshot(nextSnapshot)
|
|
400
|
+
);
|
|
401
|
+
if (!next) return;
|
|
341
402
|
engineRef.current?.applySnapshot(next);
|
|
342
403
|
snapshotRef.current = next;
|
|
404
|
+
acceptedSnapshotRef.current = next;
|
|
343
405
|
appliedSnapshotRef.current = next;
|
|
344
|
-
synchronizeSlots(
|
|
406
|
+
synchronizeSlots(next);
|
|
345
407
|
},
|
|
346
408
|
applyPatches(patches) {
|
|
347
|
-
|
|
409
|
+
const accepted = containNativeListInput(() => validatePatches(patches));
|
|
410
|
+
if (accepted && accepted.length > 0) {
|
|
348
411
|
const engine = engineRef.current;
|
|
349
412
|
if (engine) {
|
|
350
|
-
engine.applyPatches(
|
|
413
|
+
engine.applyPatches(accepted);
|
|
351
414
|
snapshotRef.current = engine.currentSnapshot();
|
|
352
|
-
} else
|
|
353
|
-
|
|
415
|
+
} else {
|
|
416
|
+
const next = containNativeListInput(() =>
|
|
417
|
+
applyRowPatches(snapshotRef.current, accepted)
|
|
418
|
+
);
|
|
419
|
+
if (next) snapshotRef.current = next;
|
|
420
|
+
}
|
|
421
|
+
acceptedSnapshotRef.current = snapshotRef.current;
|
|
354
422
|
}
|
|
355
423
|
},
|
|
356
424
|
reconcileSelection(selectedKeys) {
|
|
@@ -454,7 +522,7 @@ export const NativeList = forwardRef<NativeListRef, NativeListProps>(
|
|
|
454
522
|
const padding = slotState.padding;
|
|
455
523
|
const content = (
|
|
456
524
|
<View
|
|
457
|
-
ref={setBoundsRef}
|
|
525
|
+
ref={sidecarLayout ? undefined : setBoundsRef}
|
|
458
526
|
style={{ position: 'relative', flexShrink: 0, minWidth: 0 }}
|
|
459
527
|
>
|
|
460
528
|
{listHeader !== undefined ? (
|
|
@@ -472,13 +540,55 @@ export const NativeList = forwardRef<NativeListRef, NativeListProps>(
|
|
|
472
540
|
</View>
|
|
473
541
|
) : null}
|
|
474
542
|
{listFooter !== undefined ? (
|
|
475
|
-
<View
|
|
543
|
+
<View
|
|
544
|
+
testID="native-list-footer-slot"
|
|
545
|
+
style={{ paddingHorizontal: padding }}
|
|
546
|
+
>
|
|
547
|
+
{listFooter}
|
|
548
|
+
</View>
|
|
476
549
|
) : null}
|
|
477
550
|
</View>
|
|
478
551
|
);
|
|
552
|
+
const bandWidth = sidecarLayout
|
|
553
|
+
? Math.min(viewportWidth, sidecarLayout.maxContentWidth)
|
|
554
|
+
: 0;
|
|
555
|
+
const sidecarMargin = Math.max(0, (viewportWidth - bandWidth) / 2);
|
|
556
|
+
const leftWidth = Math.max(
|
|
557
|
+
0,
|
|
558
|
+
bandWidth - (sidecarLayout?.width ?? 0) - (sidecarLayout?.gap ?? 0)
|
|
559
|
+
);
|
|
560
|
+
const scrollContent = sidecarLayout ? (
|
|
561
|
+
<View
|
|
562
|
+
ref={setBoundsRef}
|
|
563
|
+
style={{ position: 'relative', minHeight: sidecarHeight }}
|
|
564
|
+
>
|
|
565
|
+
<View style={{ marginStart: sidecarMargin, width: leftWidth }}>
|
|
566
|
+
{content}
|
|
567
|
+
</View>
|
|
568
|
+
<View
|
|
569
|
+
style={{
|
|
570
|
+
position: 'absolute',
|
|
571
|
+
end: sidecarMargin,
|
|
572
|
+
top: 0,
|
|
573
|
+
width: sidecarLayout.width,
|
|
574
|
+
}}
|
|
575
|
+
onLayout={(event) =>
|
|
576
|
+
setSidecarHeight(event.nativeEvent.layout.height)
|
|
577
|
+
}
|
|
578
|
+
>
|
|
579
|
+
{listSidecar}
|
|
580
|
+
</View>
|
|
581
|
+
</View>
|
|
582
|
+
) : (
|
|
583
|
+
content
|
|
584
|
+
);
|
|
479
585
|
return (
|
|
480
586
|
<View
|
|
481
587
|
{...viewProps}
|
|
588
|
+
onLayout={(event) => {
|
|
589
|
+
setViewportWidth(event.nativeEvent.layout.width);
|
|
590
|
+
viewProps.onLayout?.(event);
|
|
591
|
+
}}
|
|
482
592
|
style={[viewProps.style, { position: 'relative', minHeight: 0 }]}
|
|
483
593
|
>
|
|
484
594
|
{webScrollHost === undefined ? (
|
|
@@ -486,10 +596,10 @@ export const NativeList = forwardRef<NativeListRef, NativeListProps>(
|
|
|
486
596
|
ref={setScrollHostRef}
|
|
487
597
|
style={{ position: 'absolute', inset: 0, overflow: 'scroll' }}
|
|
488
598
|
>
|
|
489
|
-
{
|
|
599
|
+
{scrollContent}
|
|
490
600
|
</View>
|
|
491
601
|
) : (
|
|
492
|
-
|
|
602
|
+
scrollContent
|
|
493
603
|
)}
|
|
494
604
|
</View>
|
|
495
605
|
);
|
package/src/models.ts
CHANGED
|
@@ -185,6 +185,7 @@ export const ROW_BOX_STYLE_KEYS_BY_TYPE = {
|
|
|
185
185
|
'trailingGap',
|
|
186
186
|
'image',
|
|
187
187
|
],
|
|
188
|
+
buttonGroup: [],
|
|
188
189
|
system: ['horizontalPadding', 'verticalPadding', 'lineGap'],
|
|
189
190
|
} as const;
|
|
190
191
|
|
|
@@ -201,6 +202,7 @@ type TemplateBoxStyle<T extends keyof typeof ROW_BOX_STYLE_KEYS_BY_TYPE> = Pick<
|
|
|
201
202
|
*/
|
|
202
203
|
export type IdentityRowStyle = TemplateBoxStyle<'identity'> &
|
|
203
204
|
Readonly<{
|
|
205
|
+
leadingContentMaxWidthRatio?: number;
|
|
204
206
|
title?: NativeListTextStyle;
|
|
205
207
|
subtitle?: NativeListTextStyle;
|
|
206
208
|
tertiary?: NativeListTextStyle;
|
|
@@ -279,8 +281,16 @@ export type SectionHeaderRowStyle = TemplateBoxStyle<'sectionHeader'> &
|
|
|
279
281
|
title?: NativeListTextStyle;
|
|
280
282
|
subtitle?: NativeListTextStyle;
|
|
281
283
|
value?: NativeListTextStyle;
|
|
284
|
+
valuePlacement?: 'afterTitle';
|
|
285
|
+
titleDecoration?: 'none' | 'dashed';
|
|
282
286
|
}>;
|
|
283
287
|
|
|
288
|
+
export type RowTextHelp = Readonly<{
|
|
289
|
+
actionKey: string;
|
|
290
|
+
presentation: 'tooltip' | 'popover';
|
|
291
|
+
underline?: 'dashed';
|
|
292
|
+
}>;
|
|
293
|
+
|
|
284
294
|
export type ActionRowStyle = TemplateBoxStyle<'action'> &
|
|
285
295
|
Readonly<{
|
|
286
296
|
title?: NativeListTextStyle;
|
|
@@ -344,19 +354,27 @@ export type VisualOverlay = Readonly<{
|
|
|
344
354
|
offsetX?: number;
|
|
345
355
|
offsetY?: number;
|
|
346
356
|
image?: ImageSource;
|
|
357
|
+
fallbackIcon?: Readonly<{ name: string; tintColor?: string }>;
|
|
347
358
|
name?: string;
|
|
348
359
|
text?: string;
|
|
360
|
+
fontWeight?: NativeListTextStyle['fontWeight'];
|
|
349
361
|
tintColor?: string;
|
|
350
362
|
backgroundColor?: string;
|
|
351
363
|
}>;
|
|
352
364
|
|
|
353
365
|
type VisualWithImage = Readonly<{
|
|
354
|
-
fallbackIcon?: Readonly<{
|
|
366
|
+
fallbackIcon?: Readonly<{
|
|
367
|
+
name: string;
|
|
368
|
+
tintColor?: string;
|
|
369
|
+
size?: number;
|
|
370
|
+
backgroundColor?: string;
|
|
371
|
+
}>;
|
|
355
372
|
overlays?: readonly VisualOverlay[];
|
|
356
373
|
borderStyle?: 'dashed';
|
|
357
374
|
borderColor?: string;
|
|
358
375
|
image?: ImageSource;
|
|
359
376
|
fallbackText?: string;
|
|
377
|
+
fallbackTextColor?: string;
|
|
360
378
|
backgroundColor?: string;
|
|
361
379
|
shape?: 'circle' | 'rounded' | 'square';
|
|
362
380
|
cornerIcon?: Readonly<{
|
|
@@ -408,9 +426,26 @@ export type TrailingAccessory =
|
|
|
408
426
|
kind: 'valuePair';
|
|
409
427
|
primary: string;
|
|
410
428
|
secondary: string;
|
|
429
|
+
primaryFontWeight?: 'medium';
|
|
430
|
+
primaryHelp?: RowTextHelp;
|
|
431
|
+
primaryTextSegments?: readonly ValueTextSegment[];
|
|
432
|
+
secondaryTextSegments?: readonly ValueTextSegment[];
|
|
411
433
|
primaryTone?: TextTone;
|
|
412
434
|
secondaryTone?: TextTone;
|
|
413
435
|
}>
|
|
436
|
+
| Readonly<{
|
|
437
|
+
kind: 'button';
|
|
438
|
+
label: string;
|
|
439
|
+
actionKey: string;
|
|
440
|
+
disabled?: boolean;
|
|
441
|
+
testID?: string;
|
|
442
|
+
accessibilityLabel?: string;
|
|
443
|
+
textColor?: string;
|
|
444
|
+
backgroundColor?: string;
|
|
445
|
+
pressedBackgroundColor?: string;
|
|
446
|
+
hoverBackgroundColor?: string;
|
|
447
|
+
focusRingColor?: string;
|
|
448
|
+
}>
|
|
414
449
|
| Readonly<{
|
|
415
450
|
kind: 'checkbox';
|
|
416
451
|
state: CheckboxState;
|
|
@@ -438,6 +473,7 @@ export type TrailingAccessory =
|
|
|
438
473
|
kind: 'icon';
|
|
439
474
|
name: string;
|
|
440
475
|
tintColor?: string;
|
|
476
|
+
buttonStyle?: 'tertiary';
|
|
441
477
|
disabled?: boolean;
|
|
442
478
|
actionKey?: string;
|
|
443
479
|
testID?: string;
|
|
@@ -480,6 +516,10 @@ export type RowBase = Readonly<{
|
|
|
480
516
|
export type IdentityRow = RowBase &
|
|
481
517
|
Readonly<{
|
|
482
518
|
type: 'identity';
|
|
519
|
+
/** Opt in to content-based height; explicit row/container height still wins. */
|
|
520
|
+
contentHeight?: 'auto';
|
|
521
|
+
/** Emits a row action instead of a press after a successful long press. */
|
|
522
|
+
longPressActionKey?: string;
|
|
483
523
|
// OneKey patch: UTF-16 ranges match Fuse indices and native attributed strings.
|
|
484
524
|
titleMatch?: readonly Readonly<{ start: number; end: number }>[];
|
|
485
525
|
titleActionKey?: string;
|
|
@@ -489,11 +529,27 @@ export type IdentityRow = RowBase &
|
|
|
489
529
|
leading: LeadingVisual;
|
|
490
530
|
leadingAction?: Extract<TrailingAccessory, { kind: 'icon' }>;
|
|
491
531
|
title: string;
|
|
532
|
+
/** Plain 12/16 labels beside the title, preserving independent tones. */
|
|
533
|
+
titleSuffixes?: readonly Readonly<{
|
|
534
|
+
text: string;
|
|
535
|
+
tone: 'secondary' | 'disabled';
|
|
536
|
+
maxWidth?: number;
|
|
537
|
+
}>[];
|
|
538
|
+
titleIcon?: Readonly<{
|
|
539
|
+
name: string;
|
|
540
|
+
tintColor?: string;
|
|
541
|
+
accessibilityLabel?: string;
|
|
542
|
+
/** Web-only anchored help from this icon; does not add a click action. */
|
|
543
|
+
hoverActionKey?: string;
|
|
544
|
+
}>;
|
|
545
|
+
/** Web-only additional help icon after titleIcon. */
|
|
546
|
+
secondaryTitleIcon?: IdentityRow['titleIcon'];
|
|
492
547
|
subtitle?: string;
|
|
493
548
|
tertiary?: string;
|
|
494
549
|
tertiaryTone?: 'secondary' | 'info';
|
|
495
550
|
titleLines?: 1 | 2;
|
|
496
|
-
|
|
551
|
+
/** Zero displays the complete subtitle. */
|
|
552
|
+
subtitleLines?: 0 | 1 | 2;
|
|
497
553
|
badges?: readonly BadgeModel[];
|
|
498
554
|
trailing?: readonly TrailingAccessory[];
|
|
499
555
|
draggable?: boolean;
|
|
@@ -534,6 +590,7 @@ export type ActivityRow = RowBase &
|
|
|
534
590
|
Readonly<{
|
|
535
591
|
type: 'activity';
|
|
536
592
|
leading: LeadingVisual;
|
|
593
|
+
hideLeading?: boolean;
|
|
537
594
|
secondaryLeading?: LeadingVisual;
|
|
538
595
|
title: string;
|
|
539
596
|
description?: string;
|
|
@@ -559,11 +616,14 @@ export type ActivityRow = RowBase &
|
|
|
559
616
|
export type MessageRow = RowBase &
|
|
560
617
|
Readonly<{
|
|
561
618
|
type: 'message';
|
|
619
|
+
/** Draws only top and bottom container borders when a border is supplied. */
|
|
620
|
+
presentation?: 'inlineWarning';
|
|
562
621
|
unread?: boolean;
|
|
563
622
|
leading?: LeadingVisual;
|
|
564
623
|
title: string;
|
|
565
624
|
body: string;
|
|
566
|
-
|
|
625
|
+
/** Zero displays the complete body. */
|
|
626
|
+
bodyLines?: 0 | 1 | 2 | 3;
|
|
567
627
|
time: string;
|
|
568
628
|
thumbnail?: ImageSource;
|
|
569
629
|
style?: MessageRowStyle;
|
|
@@ -572,8 +632,12 @@ export type MessageRow = RowBase &
|
|
|
572
632
|
export type DataColumn = Readonly<{
|
|
573
633
|
key: string;
|
|
574
634
|
text: string;
|
|
635
|
+
textSegments?: readonly ValueTextSegment[];
|
|
636
|
+
titleIcon?: IdentityRow['titleIcon'];
|
|
637
|
+
secondaryTitleIcon?: IdentityRow['titleIcon'];
|
|
575
638
|
secondaryLeadingText?: string;
|
|
576
639
|
secondaryText?: string;
|
|
640
|
+
secondaryTextSegments?: readonly ValueTextSegment[];
|
|
577
641
|
weight?: 1 | 2 | 3;
|
|
578
642
|
alignment?: 'start' | 'center' | 'end';
|
|
579
643
|
tone?: 'primary' | 'secondary' | 'positive' | 'negative';
|
|
@@ -585,6 +649,7 @@ export type DataRow = RowBase &
|
|
|
585
649
|
type: 'dataRow';
|
|
586
650
|
leading?: LeadingVisual;
|
|
587
651
|
columns: readonly DataColumn[];
|
|
652
|
+
trailing?: readonly TrailingAccessory[];
|
|
588
653
|
checkbox?: Extract<TrailingAccessory, { kind: 'checkbox' }>;
|
|
589
654
|
index?: number;
|
|
590
655
|
badge?: BadgeModel;
|
|
@@ -766,9 +831,11 @@ export type SectionHeaderRow = RowBase &
|
|
|
766
831
|
indexTitle?: string;
|
|
767
832
|
variant?: 'summary' | 'gallery' | 'history';
|
|
768
833
|
title: string;
|
|
834
|
+
leadingBadge?: BadgeModel;
|
|
769
835
|
titleLoading?: boolean;
|
|
770
836
|
subtitle?: string;
|
|
771
837
|
value?: string;
|
|
838
|
+
valueHelp?: RowTextHelp;
|
|
772
839
|
valueActionKey?: string;
|
|
773
840
|
titleIcon?: Extract<TrailingAccessory, { kind: 'icon' }>;
|
|
774
841
|
valueIcon?: Extract<TrailingAccessory, { kind: 'icon' }>;
|
|
@@ -789,6 +856,21 @@ export type ActionRow = RowBase &
|
|
|
789
856
|
style?: ActionRowStyle;
|
|
790
857
|
}>;
|
|
791
858
|
|
|
859
|
+
export type ButtonGroupRow = RowBase &
|
|
860
|
+
Readonly<{
|
|
861
|
+
type: 'buttonGroup';
|
|
862
|
+
buttons: readonly Readonly<{
|
|
863
|
+
key: string;
|
|
864
|
+
label: string;
|
|
865
|
+
actionKey: string;
|
|
866
|
+
disabled?: boolean;
|
|
867
|
+
loading?: boolean;
|
|
868
|
+
testID?: string;
|
|
869
|
+
accessibilityLabel?: string;
|
|
870
|
+
}>[];
|
|
871
|
+
style?: TemplateBoxStyle<'buttonGroup'>;
|
|
872
|
+
}>;
|
|
873
|
+
|
|
792
874
|
export type SystemRow = RowBase &
|
|
793
875
|
Readonly<{ style?: SystemRowStyle }> &
|
|
794
876
|
(
|
|
@@ -841,6 +923,7 @@ export type RowModel =
|
|
|
841
923
|
| MetricCardRow
|
|
842
924
|
| SectionHeaderRow
|
|
843
925
|
| ActionRow
|
|
926
|
+
| ButtonGroupRow
|
|
844
927
|
| SystemRow;
|
|
845
928
|
|
|
846
929
|
export type NativeListTheme = Readonly<{
|
|
@@ -853,6 +936,8 @@ export type NativeListTheme = Readonly<{
|
|
|
853
936
|
rowBackground: string;
|
|
854
937
|
rowSelectedBackground: string;
|
|
855
938
|
rowPressedBackground?: string;
|
|
939
|
+
/** Web-only enabled-row hover color; defaults to rowPressedBackground. */
|
|
940
|
+
rowHoverBackground?: string;
|
|
856
941
|
subduedBackground?: string;
|
|
857
942
|
strongBackground?: string;
|
|
858
943
|
/** Web-only background for a displayed declared image fallback. */
|
|
@@ -865,6 +950,8 @@ export type NativeListTheme = Readonly<{
|
|
|
865
950
|
separator: string;
|
|
866
951
|
accent: string;
|
|
867
952
|
positive: string;
|
|
953
|
+
/** Optional exact background for the success tone of section leading badges. */
|
|
954
|
+
successBackground?: string;
|
|
868
955
|
negative: string;
|
|
869
956
|
criticalBackground?: string;
|
|
870
957
|
inverseBackground?: string;
|
|
@@ -911,6 +998,12 @@ export type NativeListListStyle = Readonly<{
|
|
|
911
998
|
export type NativeListSnapshot = Readonly<{
|
|
912
999
|
schemaVersion: 1;
|
|
913
1000
|
generation: number;
|
|
1001
|
+
/** One-shot animation for a user-initiated row-key insertion or removal. */
|
|
1002
|
+
structuralTransition?: Readonly<{
|
|
1003
|
+
id: string;
|
|
1004
|
+
durationMs?: number;
|
|
1005
|
+
anchorKey?: string;
|
|
1006
|
+
}>;
|
|
914
1007
|
layout: Readonly<{
|
|
915
1008
|
kind: NativeListLayout;
|
|
916
1009
|
orientation?: NativeListOrientation;
|
|
@@ -968,7 +1061,13 @@ export type RowPatch =
|
|
|
968
1061
|
IdentityRow,
|
|
969
1062
|
| CommonPatchFields
|
|
970
1063
|
| 'title'
|
|
1064
|
+
| 'titleSuffixes'
|
|
1065
|
+
| 'titleIcon'
|
|
1066
|
+
| 'secondaryTitleIcon'
|
|
971
1067
|
| 'subtitle'
|
|
1068
|
+
| 'subtitleLines'
|
|
1069
|
+
| 'contentHeight'
|
|
1070
|
+
| 'longPressActionKey'
|
|
972
1071
|
| 'tertiary'
|
|
973
1072
|
| 'tertiaryTone'
|
|
974
1073
|
| 'badges'
|
|
@@ -1010,6 +1109,7 @@ export type RowPatch =
|
|
|
1010
1109
|
| 'primaryAmount'
|
|
1011
1110
|
| 'secondaryAmount'
|
|
1012
1111
|
| 'leading'
|
|
1112
|
+
| 'hideLeading'
|
|
1013
1113
|
| 'secondaryLeading'
|
|
1014
1114
|
| 'footerActions'
|
|
1015
1115
|
>
|
|
@@ -1026,6 +1126,7 @@ export type RowPatch =
|
|
|
1026
1126
|
| 'title'
|
|
1027
1127
|
| 'body'
|
|
1028
1128
|
| 'bodyLines'
|
|
1129
|
+
| 'presentation'
|
|
1029
1130
|
| 'time'
|
|
1030
1131
|
| 'thumbnail'
|
|
1031
1132
|
>
|
|
@@ -1040,6 +1141,7 @@ export type RowPatch =
|
|
|
1040
1141
|
| CommonPatchFields
|
|
1041
1142
|
| 'leading'
|
|
1042
1143
|
| 'columns'
|
|
1144
|
+
| 'trailing'
|
|
1043
1145
|
| 'checkbox'
|
|
1044
1146
|
| 'index'
|
|
1045
1147
|
| 'badge'
|
|
@@ -1124,6 +1226,8 @@ export type RowPatch =
|
|
|
1124
1226
|
| 'title'
|
|
1125
1227
|
| 'subtitle'
|
|
1126
1228
|
| 'value'
|
|
1229
|
+
| 'valueHelp'
|
|
1230
|
+
| 'leadingBadge'
|
|
1127
1231
|
| 'valueActionKey'
|
|
1128
1232
|
| 'titleActionKey'
|
|
1129
1233
|
| 'titleActionOnHover'
|
|
@@ -1148,6 +1252,11 @@ export type RowPatch =
|
|
|
1148
1252
|
>
|
|
1149
1253
|
>;
|
|
1150
1254
|
}>
|
|
1255
|
+
| Readonly<{
|
|
1256
|
+
type: 'buttonGroup';
|
|
1257
|
+
key: string;
|
|
1258
|
+
changes: Partial<Pick<ButtonGroupRow, CommonPatchFields | 'buttons'>>;
|
|
1259
|
+
}>
|
|
1151
1260
|
| Readonly<{
|
|
1152
1261
|
type: 'system';
|
|
1153
1262
|
key: string;
|
|
@@ -1164,6 +1273,7 @@ export type NativeListActionSource =
|
|
|
1164
1273
|
| 'leadingAction'
|
|
1165
1274
|
| 'trailingAccessory'
|
|
1166
1275
|
| 'footerAction'
|
|
1276
|
+
| 'buttonGroup'
|
|
1167
1277
|
| 'description'
|
|
1168
1278
|
| 'mediaClose';
|
|
1169
1279
|
|