@onekeyfe/react-native-native-list 6.7.0-alpha.359 → 6.7.0-alpha.363
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 +0 -7
- package/android/src/main/java/com/onekey/nativelist/NativeListAccessoryStack.kt +7 -240
- package/android/src/main/java/com/onekey/nativelist/NativeListActivityDetailsView.kt +4 -7
- package/android/src/main/java/com/onekey/nativelist/NativeListActivityRenderer.kt +3 -6
- package/android/src/main/java/com/onekey/nativelist/NativeListContainerSlotAdapter.kt +0 -12
- package/android/src/main/java/com/onekey/nativelist/NativeListDataRowRenderer.kt +7 -87
- package/android/src/main/java/com/onekey/nativelist/NativeListIdentityRenderer.kt +1 -135
- package/android/src/main/java/com/onekey/nativelist/NativeListLeadingVisual.kt +14 -43
- package/android/src/main/java/com/onekey/nativelist/NativeListMessageRenderer.kt +0 -25
- package/android/src/main/java/com/onekey/nativelist/NativeListModels.kt +2 -17
- package/android/src/main/java/com/onekey/nativelist/NativeListPrimitives.kt +0 -22
- package/android/src/main/java/com/onekey/nativelist/NativeListRendererRegistry.kt +0 -2
- package/android/src/main/java/com/onekey/nativelist/NativeListRendererRowView.kt +0 -2
- package/android/src/main/java/com/onekey/nativelist/NativeListResolvedText.kt +2 -3
- package/android/src/main/java/com/onekey/nativelist/NativeListSectionHeaderRenderer.kt +0 -69
- package/android/src/main/java/com/onekey/nativelist/NativeListTextView.kt +1 -55
- package/android/src/main/java/com/onekey/nativelist/NativeListView.kt +29 -587
- package/android/src/test/java/com/margelo/nitro/nativelist/NativeListPressPolicyTest.kt +0 -1
- package/docs/ROW_TEMPLATES.md +9 -60
- package/docs/SPEC.md +15 -317
- package/docs/STYLE_SPEC.md +0 -6
- package/ios/HybridNativeList.swift +0 -10
- package/ios/NativeListAccessoryStack.swift +37 -220
- package/ios/NativeListActivityDetailsView.swift +8 -18
- package/ios/NativeListActivityRenderer.swift +2 -8
- package/ios/NativeListDataRowRenderer.swift +16 -128
- package/ios/NativeListDesignAssets.swift +0 -3
- package/ios/NativeListIdentityRenderer.swift +5 -123
- package/ios/NativeListLeadingVisual.swift +14 -49
- package/ios/NativeListMessageRenderer.swift +1 -34
- package/ios/NativeListModels.swift +2 -16
- package/ios/NativeListRendererRegistry.swift +0 -1
- package/ios/NativeListResolvedText.swift +1 -2
- package/ios/NativeListRowHost.swift +0 -14
- package/ios/NativeListSectionHeaderRenderer.swift +0 -88
- package/ios/RNCNativeListView.swift +29 -335
- package/ios/tests/NativeListActivityPresentationTests.swift +0 -56
- package/ios/tests/NativeListLifecycleTests.swift +3 -1283
- package/lib/module/NativeList.js +21 -39
- package/lib/module/NativeList.web.js +4 -51
- package/lib/module/models.js +0 -1
- package/lib/module/selection.js +1 -1
- package/lib/module/validation.js +8 -320
- package/lib/module/web/NativeListWebEngine.js +18 -373
- package/lib/module/web/templates/ActivityRowRenderer.js +7 -8
- package/lib/module/web/templates/DataRowRenderer.js +5 -40
- package/lib/module/web/templates/IdentityRowRenderer.js +4 -90
- package/lib/module/web/templates/MessageRowRenderer.js +2 -18
- package/lib/module/web/templates/RowContainerStyle.js +0 -1
- package/lib/module/web/templates/RowRendererRegistry.js +0 -3
- package/lib/module/web/templates/SectionHeaderRowRenderer.js +2 -36
- package/lib/nitrogen/generated/android/c++/JHybridNativeListSpec.cpp +0 -9
- package/lib/nitrogen/generated/android/c++/JHybridNativeListSpec.hpp +0 -2
- package/lib/nitrogen/generated/android/c++/views/JHybridNativeListStateUpdater.cpp +0 -5
- package/lib/nitrogen/generated/android/kotlin/com/margelo/nitro/nativelist/HybridNativeListSpec.kt +0 -6
- package/lib/nitrogen/generated/ios/c++/HybridNativeListSpecSwift.hpp +0 -7
- package/lib/nitrogen/generated/ios/c++/views/HybridNativeListComponent.mm +0 -6
- package/lib/nitrogen/generated/ios/swift/HybridNativeListSpec.swift +0 -1
- package/lib/nitrogen/generated/ios/swift/HybridNativeListSpec_cxx.swift +0 -11
- package/lib/nitrogen/generated/shared/c++/HybridNativeListSpec.cpp +0 -2
- package/lib/nitrogen/generated/shared/c++/HybridNativeListSpec.hpp +0 -2
- package/lib/nitrogen/generated/shared/c++/views/HybridNativeListComponent.cpp +0 -2
- package/lib/nitrogen/generated/shared/c++/views/HybridNativeListComponent.hpp +0 -3
- package/lib/nitrogen/generated/shared/json/NativeListConfig.json +0 -1
- package/lib/typescript/src/NativeList.nitro.d.ts +0 -1
- package/lib/typescript/src/NativeList.types.d.ts +0 -8
- package/lib/typescript/src/models.d.ts +9 -101
- package/lib/typescript/src/validation.d.ts +0 -10
- package/lib/typescript/src/web/NativeListWebEngine.d.ts +0 -26
- package/lib/typescript/src/web/templates/IdentityRowRenderer.d.ts +1 -1
- package/lib/typescript/src/web/templates/MessageRowRenderer.d.ts +3 -9
- package/nitrogen/generated/android/c++/JHybridNativeListSpec.cpp +0 -9
- package/nitrogen/generated/android/c++/JHybridNativeListSpec.hpp +0 -2
- package/nitrogen/generated/android/c++/views/JHybridNativeListStateUpdater.cpp +0 -5
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nativelist/HybridNativeListSpec.kt +0 -6
- package/nitrogen/generated/ios/c++/HybridNativeListSpecSwift.hpp +0 -7
- package/nitrogen/generated/ios/c++/views/HybridNativeListComponent.mm +0 -6
- package/nitrogen/generated/ios/swift/HybridNativeListSpec.swift +0 -1
- package/nitrogen/generated/ios/swift/HybridNativeListSpec_cxx.swift +0 -11
- package/nitrogen/generated/shared/c++/HybridNativeListSpec.cpp +0 -2
- package/nitrogen/generated/shared/c++/HybridNativeListSpec.hpp +0 -2
- package/nitrogen/generated/shared/c++/views/HybridNativeListComponent.cpp +0 -2
- package/nitrogen/generated/shared/c++/views/HybridNativeListComponent.hpp +0 -3
- package/nitrogen/generated/shared/json/NativeListConfig.json +0 -1
- package/package.json +3 -3
- package/react-native-native-list.podspec +0 -1
- package/src/NativeList.nitro.ts +0 -1
- package/src/NativeList.tsx +24 -72
- package/src/NativeList.types.ts +0 -9
- package/src/NativeList.web.tsx +8 -72
- package/src/models.ts +3 -113
- package/src/selection.ts +0 -1
- package/src/validation.ts +6 -721
- package/src/web/NativeListWebEngine.ts +19 -568
- package/src/web/templates/ActivityRowRenderer.ts +6 -14
- package/src/web/templates/DataRowRenderer.ts +20 -93
- package/src/web/templates/IdentityRowRenderer.ts +5 -150
- package/src/web/templates/MessageRowRenderer.ts +7 -23
- package/src/web/templates/RowContainerStyle.ts +0 -2
- package/src/web/templates/RowRendererRegistry.ts +1 -11
- package/src/web/templates/SectionHeaderRowRenderer.ts +4 -47
- package/android/src/main/java/com/onekey/nativelist/NativeListButtonGroupRenderer.kt +0 -102
- package/ios/NativeListButtonGroupRenderer.swift +0 -89
- package/ios/Resources/NativeListIcons.xcassets/onekey_crypto_coin_outline.imageset/Contents.json +0 -15
- package/ios/Resources/NativeListIcons.xcassets/onekey_crypto_coin_outline.imageset/icon.svg +0 -4
- package/ios/Resources/NativeListIcons.xcassets/onekey_gas_solid.imageset/Contents.json +0 -15
- package/ios/Resources/NativeListIcons.xcassets/onekey_gas_solid.imageset/icon.svg +0 -3
- package/ios/Resources/NativeListIcons.xcassets/onekey_refresh_ccw_outline.imageset/Contents.json +0 -15
- package/ios/Resources/NativeListIcons.xcassets/onekey_refresh_ccw_outline.imageset/icon.svg +0 -3
- package/lib/module/web/templates/ButtonGroupRowRenderer.js +0 -47
- package/lib/typescript/src/web/templates/ButtonGroupRowRenderer.d.ts +0 -14
- package/src/web/templates/ButtonGroupRowRenderer.ts +0 -58
package/src/NativeList.nitro.ts
CHANGED
|
@@ -13,7 +13,6 @@ export interface NativeListNativeProps extends HybridViewProps {
|
|
|
13
13
|
snapshotJson: string;
|
|
14
14
|
fontFamiliesJson: string;
|
|
15
15
|
containerSlotHeightsJson: string;
|
|
16
|
-
sidecarLayoutJson: string;
|
|
17
16
|
topScrollEdgeEffect: NativeListScrollEdgeEffect;
|
|
18
17
|
topOverlayHeight: number;
|
|
19
18
|
scrollPositionThresholdsJson: string;
|
package/src/NativeList.tsx
CHANGED
|
@@ -44,11 +44,11 @@ import {
|
|
|
44
44
|
type NormalizedPositionScroll,
|
|
45
45
|
} from './scrolling';
|
|
46
46
|
import {
|
|
47
|
-
|
|
48
|
-
captureNativeListInput,
|
|
47
|
+
applyRowPatches,
|
|
49
48
|
containNativeListInput,
|
|
50
49
|
emptyNativeListSnapshot,
|
|
51
|
-
|
|
50
|
+
serializePatches,
|
|
51
|
+
validatePatches,
|
|
52
52
|
validateSnapshot,
|
|
53
53
|
} from './validation';
|
|
54
54
|
|
|
@@ -107,8 +107,6 @@ export const NativeList = forwardRef<NativeListRef, NativeListProps>(
|
|
|
107
107
|
listHeader,
|
|
108
108
|
listFooter,
|
|
109
109
|
listEmpty,
|
|
110
|
-
listSidecar,
|
|
111
|
-
sidecarLayout,
|
|
112
110
|
topOverlay,
|
|
113
111
|
topScrollEdgeEffect,
|
|
114
112
|
scrollPositionThresholds,
|
|
@@ -137,48 +135,17 @@ export const NativeList = forwardRef<NativeListRef, NativeListProps>(
|
|
|
137
135
|
) {
|
|
138
136
|
const snapshotRef = useRef<NativeListSnapshot>(emptyNativeListSnapshot());
|
|
139
137
|
const initializedSnapshot = useRef(false);
|
|
140
|
-
const
|
|
141
|
-
const sidecarWidth = sidecarLayout?.width;
|
|
142
|
-
const sidecarGap = sidecarLayout?.gap;
|
|
143
|
-
const sidecarMaxContentWidth = sidecarLayout?.maxContentWidth;
|
|
144
|
-
const hasContainerSlots = Boolean(
|
|
145
|
-
listHeader || listEmpty || listFooter || listSidecar
|
|
146
|
-
);
|
|
138
|
+
const hasContainerSlots = Boolean(listHeader || listEmpty || listFooter);
|
|
147
139
|
const prepareSnapshot = useCallback(
|
|
148
140
|
(next: NativeListSnapshot) => {
|
|
149
|
-
const accepted = validateSnapshot(
|
|
141
|
+
const accepted = validateSnapshot(next);
|
|
150
142
|
if (hasContainerSlots && accepted.layout.orientation === 'horizontal')
|
|
151
143
|
throw new Error(
|
|
152
144
|
'NativeList container slots require vertical orientation'
|
|
153
145
|
);
|
|
154
|
-
|
|
155
|
-
throw new Error(
|
|
156
|
-
'listSidecar and sidecarLayout must be supplied together'
|
|
157
|
-
);
|
|
158
|
-
if (sidecarWidth !== undefined) {
|
|
159
|
-
const width = sidecarWidth;
|
|
160
|
-
const gap = sidecarGap ?? NaN;
|
|
161
|
-
const maxContentWidth = sidecarMaxContentWidth ?? NaN;
|
|
162
|
-
if (
|
|
163
|
-
accepted.layout.kind !== 'linear' ||
|
|
164
|
-
!Number.isFinite(width) ||
|
|
165
|
-
width <= 0 ||
|
|
166
|
-
!Number.isFinite(gap) ||
|
|
167
|
-
gap < 0 ||
|
|
168
|
-
!Number.isFinite(maxContentWidth) ||
|
|
169
|
-
maxContentWidth <= width + gap
|
|
170
|
-
)
|
|
171
|
-
throw new Error('Invalid NativeList sidecar layout');
|
|
172
|
-
}
|
|
173
|
-
return ownValidatedNativeSnapshot(accepted);
|
|
146
|
+
return accepted;
|
|
174
147
|
},
|
|
175
|
-
[
|
|
176
|
-
hasContainerSlots,
|
|
177
|
-
hasSidecar,
|
|
178
|
-
sidecarWidth,
|
|
179
|
-
sidecarGap,
|
|
180
|
-
sidecarMaxContentWidth,
|
|
181
|
-
]
|
|
148
|
+
[hasContainerSlots]
|
|
182
149
|
);
|
|
183
150
|
const snapshot = useMemo(
|
|
184
151
|
() =>
|
|
@@ -187,8 +154,7 @@ export const NativeList = forwardRef<NativeListRef, NativeListProps>(
|
|
|
187
154
|
[inputSnapshot, prepareSnapshot]
|
|
188
155
|
);
|
|
189
156
|
const fontFamiliesJson = useNativeListFontFamiliesJson();
|
|
190
|
-
const [slotHeights, setSlotHeights] = useState([0, 0, 0
|
|
191
|
-
const [viewportWidth, setViewportWidth] = useState(0);
|
|
157
|
+
const [slotHeights, setSlotHeights] = useState([0, 0, 0]);
|
|
192
158
|
const [topOverlayHeight, setTopOverlayHeight] = useState(0);
|
|
193
159
|
const hasTopOverlay =
|
|
194
160
|
Platform?.OS === 'ios' &&
|
|
@@ -196,23 +162,11 @@ export const NativeList = forwardRef<NativeListRef, NativeListProps>(
|
|
|
196
162
|
(topScrollEdgeEffect === 'hard' || topScrollEdgeEffect === 'soft') &&
|
|
197
163
|
topOverlay != null;
|
|
198
164
|
const containerSlotHeightsJson = JSON.stringify(slotHeights);
|
|
199
|
-
const
|
|
165
|
+
const slotInset =
|
|
200
166
|
snapshot.layout.contentPaddingHorizontal ??
|
|
201
167
|
snapshot.layout.contentPadding ??
|
|
202
168
|
0;
|
|
203
|
-
const
|
|
204
|
-
? Math.min(viewportWidth, sidecarLayout.maxContentWidth)
|
|
205
|
-
: 0;
|
|
206
|
-
const slotInset = sidecarLayout
|
|
207
|
-
? Math.max(0, (viewportWidth - bandWidth) / 2)
|
|
208
|
-
: defaultSlotInset;
|
|
209
|
-
const sidecarSpace = sidecarLayout
|
|
210
|
-
? sidecarLayout.width + sidecarLayout.gap
|
|
211
|
-
: 0;
|
|
212
|
-
const slotContents = [listHeader, listEmpty, listFooter, listSidecar];
|
|
213
|
-
const sidecarLayoutJson = sidecarLayout
|
|
214
|
-
? JSON.stringify(sidecarLayout)
|
|
215
|
-
: '';
|
|
169
|
+
const slotContents = [listHeader, listEmpty, listFooter];
|
|
216
170
|
const normalizedKeyboardShouldPersistTaps =
|
|
217
171
|
keyboardShouldPersistTaps === true
|
|
218
172
|
? 'always'
|
|
@@ -422,9 +376,14 @@ export const NativeList = forwardRef<NativeListRef, NativeListProps>(
|
|
|
422
376
|
}
|
|
423
377
|
},
|
|
424
378
|
applyPatches(patches) {
|
|
425
|
-
const accepted = containNativeListInput(() =>
|
|
426
|
-
|
|
427
|
-
|
|
379
|
+
const accepted = containNativeListInput(() => {
|
|
380
|
+
const normalized = validatePatches(patches);
|
|
381
|
+
return {
|
|
382
|
+
patches: normalized,
|
|
383
|
+
snapshot: applyRowPatches(snapshotRef.current, normalized),
|
|
384
|
+
json: serializePatches(normalized),
|
|
385
|
+
};
|
|
386
|
+
});
|
|
428
387
|
if (!accepted || accepted.patches.length === 0) return;
|
|
429
388
|
const nextSnapshot = accepted.snapshot;
|
|
430
389
|
const native = nativeRef.current;
|
|
@@ -442,19 +401,18 @@ export const NativeList = forwardRef<NativeListRef, NativeListProps>(
|
|
|
442
401
|
updateAvatarPrefetchRef.current();
|
|
443
402
|
},
|
|
444
403
|
reconcileSelection(selectedKeys) {
|
|
445
|
-
|
|
446
|
-
nativeRef.current?.reconcileSelection(JSON.stringify(capturedKeys));
|
|
404
|
+
nativeRef.current?.reconcileSelection(JSON.stringify(selectedKeys));
|
|
447
405
|
const current = snapshotRef.current;
|
|
448
406
|
if (
|
|
449
407
|
current.selection &&
|
|
450
|
-
(current.selection.mode !== 'single' ||
|
|
451
|
-
|
|
408
|
+
(current.selection.mode !== 'single' || selectedKeys.length <= 1) &&
|
|
409
|
+
selectedKeys.every((key) =>
|
|
452
410
|
current.rows.some((row) => row.key === key && isSelectableRow(row))
|
|
453
411
|
)
|
|
454
412
|
) {
|
|
455
413
|
snapshotRef.current = {
|
|
456
414
|
...current,
|
|
457
|
-
selection: { ...current.selection, selectedKeys
|
|
415
|
+
selection: { ...current.selection, selectedKeys },
|
|
458
416
|
};
|
|
459
417
|
}
|
|
460
418
|
},
|
|
@@ -595,15 +553,10 @@ export const NativeList = forwardRef<NativeListRef, NativeListProps>(
|
|
|
595
553
|
return (
|
|
596
554
|
<NativeListHost
|
|
597
555
|
{...viewProps}
|
|
598
|
-
onLayout={(event) => {
|
|
599
|
-
setViewportWidth(event.nativeEvent.layout.width);
|
|
600
|
-
viewProps.onLayout?.(event);
|
|
601
|
-
}}
|
|
602
556
|
{...nativeCallbacks}
|
|
603
557
|
fontFamiliesJson={fontFamiliesJson}
|
|
604
558
|
snapshotJson={snapshotJson}
|
|
605
559
|
containerSlotHeightsJson={containerSlotHeightsJson}
|
|
606
|
-
sidecarLayoutJson={sidecarLayoutJson}
|
|
607
560
|
topScrollEdgeEffect={
|
|
608
561
|
hasTopOverlay ? topScrollEdgeEffect ?? 'none' : 'none'
|
|
609
562
|
}
|
|
@@ -618,9 +571,8 @@ export const NativeList = forwardRef<NativeListRef, NativeListProps>(
|
|
|
618
571
|
collapsable={false}
|
|
619
572
|
style={{
|
|
620
573
|
position: 'absolute',
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
width: index === 3 ? sidecarLayout?.width : undefined,
|
|
574
|
+
left: slotInset,
|
|
575
|
+
right: slotInset,
|
|
624
576
|
top: 0,
|
|
625
577
|
}}
|
|
626
578
|
onLayout={(event) => {
|
package/src/NativeList.types.ts
CHANGED
|
@@ -78,12 +78,6 @@ export type NativeListWebScrollHost = Readonly<{
|
|
|
78
78
|
scrollTop: number;
|
|
79
79
|
}>;
|
|
80
80
|
|
|
81
|
-
export type NativeListSidecarLayout = Readonly<{
|
|
82
|
-
width: number;
|
|
83
|
-
gap: number;
|
|
84
|
-
maxContentWidth: number;
|
|
85
|
-
}>;
|
|
86
|
-
|
|
87
81
|
type InitialScrollProps =
|
|
88
82
|
| Readonly<{
|
|
89
83
|
initialScrollIndex?: never;
|
|
@@ -137,9 +131,6 @@ export type NativeListProps = Omit<ViewProps, 'children'> &
|
|
|
137
131
|
listHeader?: ReactNode;
|
|
138
132
|
listFooter?: ReactNode;
|
|
139
133
|
listEmpty?: ReactNode;
|
|
140
|
-
/** Scrolling right column for a vertical linear list. Requires sidecarLayout. */
|
|
141
|
-
listSidecar?: ReactNode;
|
|
142
|
-
sidecarLayout?: NativeListSidecarLayout;
|
|
143
134
|
/** Fixed overlay above scrolling rows on iOS 26 and newer. */
|
|
144
135
|
topOverlay?: ReactNode;
|
|
145
136
|
/** Selects UIKit's top scroll-edge effect on iOS 26 and newer. */
|
package/src/NativeList.web.tsx
CHANGED
|
@@ -93,8 +93,6 @@ export const NativeList = forwardRef<NativeListRef, NativeListProps>(
|
|
|
93
93
|
listHeader,
|
|
94
94
|
listEmpty,
|
|
95
95
|
listFooter,
|
|
96
|
-
listSidecar,
|
|
97
|
-
sidecarLayout,
|
|
98
96
|
topOverlay: _topOverlay,
|
|
99
97
|
topScrollEdgeEffect: _topScrollEdgeEffect,
|
|
100
98
|
webScrollHost,
|
|
@@ -158,8 +156,6 @@ export const NativeList = forwardRef<NativeListRef, NativeListProps>(
|
|
|
158
156
|
snapshot.layout.contentPadding ??
|
|
159
157
|
0,
|
|
160
158
|
}));
|
|
161
|
-
const [viewportWidth, setViewportWidth] = useState(0);
|
|
162
|
-
const [sidecarHeight, setSidecarHeight] = useState(0);
|
|
163
159
|
const synchronizeSlots = (next: NativeListSnapshot) => {
|
|
164
160
|
const hasRows = next.rows.length > 0;
|
|
165
161
|
const padding =
|
|
@@ -209,7 +205,6 @@ export const NativeList = forwardRef<NativeListRef, NativeListProps>(
|
|
|
209
205
|
listHeader !== undefined ||
|
|
210
206
|
listEmpty !== undefined ||
|
|
211
207
|
listFooter !== undefined;
|
|
212
|
-
useSlotLayoutRef.current ||= listSidecar !== undefined;
|
|
213
208
|
const useSlotLayout = useSlotLayoutRef.current;
|
|
214
209
|
const resolvedScrollHost =
|
|
215
210
|
webScrollHost === undefined
|
|
@@ -222,27 +217,10 @@ export const NativeList = forwardRef<NativeListRef, NativeListProps>(
|
|
|
222
217
|
webVirtualizationEnabledRef.current = webVirtualizationEnabled;
|
|
223
218
|
const validatedSnapshot = useMemo(
|
|
224
219
|
() =>
|
|
225
|
-
containNativeListInput(() =>
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
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]
|
|
220
|
+
containNativeListInput(() =>
|
|
221
|
+
normalizeWebSnapshot(snapshot, hasEmptySlot, useSlotLayout)
|
|
222
|
+
) ?? acceptedSnapshotRef.current,
|
|
223
|
+
[snapshot, hasEmptySlot, useSlotLayout]
|
|
246
224
|
);
|
|
247
225
|
const snapshotRef = useRef(validatedSnapshot);
|
|
248
226
|
const snapshotPropRef = useRef(validatedSnapshot);
|
|
@@ -522,7 +500,7 @@ export const NativeList = forwardRef<NativeListRef, NativeListProps>(
|
|
|
522
500
|
const padding = slotState.padding;
|
|
523
501
|
const content = (
|
|
524
502
|
<View
|
|
525
|
-
ref={
|
|
503
|
+
ref={setBoundsRef}
|
|
526
504
|
style={{ position: 'relative', flexShrink: 0, minWidth: 0 }}
|
|
527
505
|
>
|
|
528
506
|
{listHeader !== undefined ? (
|
|
@@ -540,55 +518,13 @@ export const NativeList = forwardRef<NativeListRef, NativeListProps>(
|
|
|
540
518
|
</View>
|
|
541
519
|
) : null}
|
|
542
520
|
{listFooter !== undefined ? (
|
|
543
|
-
<View
|
|
544
|
-
testID="native-list-footer-slot"
|
|
545
|
-
style={{ paddingHorizontal: padding }}
|
|
546
|
-
>
|
|
547
|
-
{listFooter}
|
|
548
|
-
</View>
|
|
521
|
+
<View style={{ paddingHorizontal: padding }}>{listFooter}</View>
|
|
549
522
|
) : null}
|
|
550
523
|
</View>
|
|
551
524
|
);
|
|
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
|
-
);
|
|
585
525
|
return (
|
|
586
526
|
<View
|
|
587
527
|
{...viewProps}
|
|
588
|
-
onLayout={(event) => {
|
|
589
|
-
setViewportWidth(event.nativeEvent.layout.width);
|
|
590
|
-
viewProps.onLayout?.(event);
|
|
591
|
-
}}
|
|
592
528
|
style={[viewProps.style, { position: 'relative', minHeight: 0 }]}
|
|
593
529
|
>
|
|
594
530
|
{webScrollHost === undefined ? (
|
|
@@ -596,10 +532,10 @@ export const NativeList = forwardRef<NativeListRef, NativeListProps>(
|
|
|
596
532
|
ref={setScrollHostRef}
|
|
597
533
|
style={{ position: 'absolute', inset: 0, overflow: 'scroll' }}
|
|
598
534
|
>
|
|
599
|
-
{
|
|
535
|
+
{content}
|
|
600
536
|
</View>
|
|
601
537
|
) : (
|
|
602
|
-
|
|
538
|
+
content
|
|
603
539
|
)}
|
|
604
540
|
</View>
|
|
605
541
|
);
|
package/src/models.ts
CHANGED
|
@@ -185,7 +185,6 @@ export const ROW_BOX_STYLE_KEYS_BY_TYPE = {
|
|
|
185
185
|
'trailingGap',
|
|
186
186
|
'image',
|
|
187
187
|
],
|
|
188
|
-
buttonGroup: [],
|
|
189
188
|
system: ['horizontalPadding', 'verticalPadding', 'lineGap'],
|
|
190
189
|
} as const;
|
|
191
190
|
|
|
@@ -202,7 +201,6 @@ type TemplateBoxStyle<T extends keyof typeof ROW_BOX_STYLE_KEYS_BY_TYPE> = Pick<
|
|
|
202
201
|
*/
|
|
203
202
|
export type IdentityRowStyle = TemplateBoxStyle<'identity'> &
|
|
204
203
|
Readonly<{
|
|
205
|
-
leadingContentMaxWidthRatio?: number;
|
|
206
204
|
title?: NativeListTextStyle;
|
|
207
205
|
subtitle?: NativeListTextStyle;
|
|
208
206
|
tertiary?: NativeListTextStyle;
|
|
@@ -281,16 +279,8 @@ export type SectionHeaderRowStyle = TemplateBoxStyle<'sectionHeader'> &
|
|
|
281
279
|
title?: NativeListTextStyle;
|
|
282
280
|
subtitle?: NativeListTextStyle;
|
|
283
281
|
value?: NativeListTextStyle;
|
|
284
|
-
valuePlacement?: 'afterTitle';
|
|
285
|
-
titleDecoration?: 'none' | 'dashed';
|
|
286
282
|
}>;
|
|
287
283
|
|
|
288
|
-
export type RowTextHelp = Readonly<{
|
|
289
|
-
actionKey: string;
|
|
290
|
-
presentation: 'tooltip' | 'popover';
|
|
291
|
-
underline?: 'dashed';
|
|
292
|
-
}>;
|
|
293
|
-
|
|
294
284
|
export type ActionRowStyle = TemplateBoxStyle<'action'> &
|
|
295
285
|
Readonly<{
|
|
296
286
|
title?: NativeListTextStyle;
|
|
@@ -354,27 +344,19 @@ export type VisualOverlay = Readonly<{
|
|
|
354
344
|
offsetX?: number;
|
|
355
345
|
offsetY?: number;
|
|
356
346
|
image?: ImageSource;
|
|
357
|
-
fallbackIcon?: Readonly<{ name: string; tintColor?: string }>;
|
|
358
347
|
name?: string;
|
|
359
348
|
text?: string;
|
|
360
|
-
fontWeight?: NativeListTextStyle['fontWeight'];
|
|
361
349
|
tintColor?: string;
|
|
362
350
|
backgroundColor?: string;
|
|
363
351
|
}>;
|
|
364
352
|
|
|
365
353
|
type VisualWithImage = Readonly<{
|
|
366
|
-
fallbackIcon?: Readonly<{
|
|
367
|
-
name: string;
|
|
368
|
-
tintColor?: string;
|
|
369
|
-
size?: number;
|
|
370
|
-
backgroundColor?: string;
|
|
371
|
-
}>;
|
|
354
|
+
fallbackIcon?: Readonly<{ name: string; tintColor?: string }>;
|
|
372
355
|
overlays?: readonly VisualOverlay[];
|
|
373
356
|
borderStyle?: 'dashed';
|
|
374
357
|
borderColor?: string;
|
|
375
358
|
image?: ImageSource;
|
|
376
359
|
fallbackText?: string;
|
|
377
|
-
fallbackTextColor?: string;
|
|
378
360
|
backgroundColor?: string;
|
|
379
361
|
shape?: 'circle' | 'rounded' | 'square';
|
|
380
362
|
cornerIcon?: Readonly<{
|
|
@@ -426,26 +408,9 @@ export type TrailingAccessory =
|
|
|
426
408
|
kind: 'valuePair';
|
|
427
409
|
primary: string;
|
|
428
410
|
secondary: string;
|
|
429
|
-
primaryFontWeight?: 'medium';
|
|
430
|
-
primaryHelp?: RowTextHelp;
|
|
431
|
-
primaryTextSegments?: readonly ValueTextSegment[];
|
|
432
|
-
secondaryTextSegments?: readonly ValueTextSegment[];
|
|
433
411
|
primaryTone?: TextTone;
|
|
434
412
|
secondaryTone?: TextTone;
|
|
435
413
|
}>
|
|
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
|
-
}>
|
|
449
414
|
| Readonly<{
|
|
450
415
|
kind: 'checkbox';
|
|
451
416
|
state: CheckboxState;
|
|
@@ -473,7 +438,6 @@ export type TrailingAccessory =
|
|
|
473
438
|
kind: 'icon';
|
|
474
439
|
name: string;
|
|
475
440
|
tintColor?: string;
|
|
476
|
-
buttonStyle?: 'tertiary';
|
|
477
441
|
disabled?: boolean;
|
|
478
442
|
actionKey?: string;
|
|
479
443
|
testID?: string;
|
|
@@ -516,10 +480,6 @@ export type RowBase = Readonly<{
|
|
|
516
480
|
export type IdentityRow = RowBase &
|
|
517
481
|
Readonly<{
|
|
518
482
|
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;
|
|
523
483
|
// OneKey patch: UTF-16 ranges match Fuse indices and native attributed strings.
|
|
524
484
|
titleMatch?: readonly Readonly<{ start: number; end: number }>[];
|
|
525
485
|
titleActionKey?: string;
|
|
@@ -529,27 +489,11 @@ export type IdentityRow = RowBase &
|
|
|
529
489
|
leading: LeadingVisual;
|
|
530
490
|
leadingAction?: Extract<TrailingAccessory, { kind: 'icon' }>;
|
|
531
491
|
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'];
|
|
547
492
|
subtitle?: string;
|
|
548
493
|
tertiary?: string;
|
|
549
494
|
tertiaryTone?: 'secondary' | 'info';
|
|
550
495
|
titleLines?: 1 | 2;
|
|
551
|
-
|
|
552
|
-
subtitleLines?: 0 | 1 | 2;
|
|
496
|
+
subtitleLines?: 1 | 2;
|
|
553
497
|
badges?: readonly BadgeModel[];
|
|
554
498
|
trailing?: readonly TrailingAccessory[];
|
|
555
499
|
draggable?: boolean;
|
|
@@ -590,7 +534,6 @@ export type ActivityRow = RowBase &
|
|
|
590
534
|
Readonly<{
|
|
591
535
|
type: 'activity';
|
|
592
536
|
leading: LeadingVisual;
|
|
593
|
-
hideLeading?: boolean;
|
|
594
537
|
secondaryLeading?: LeadingVisual;
|
|
595
538
|
title: string;
|
|
596
539
|
description?: string;
|
|
@@ -616,14 +559,11 @@ export type ActivityRow = RowBase &
|
|
|
616
559
|
export type MessageRow = RowBase &
|
|
617
560
|
Readonly<{
|
|
618
561
|
type: 'message';
|
|
619
|
-
/** Draws only top and bottom container borders when a border is supplied. */
|
|
620
|
-
presentation?: 'inlineWarning';
|
|
621
562
|
unread?: boolean;
|
|
622
563
|
leading?: LeadingVisual;
|
|
623
564
|
title: string;
|
|
624
565
|
body: string;
|
|
625
|
-
|
|
626
|
-
bodyLines?: 0 | 1 | 2 | 3;
|
|
566
|
+
bodyLines?: 1 | 2 | 3;
|
|
627
567
|
time: string;
|
|
628
568
|
thumbnail?: ImageSource;
|
|
629
569
|
style?: MessageRowStyle;
|
|
@@ -632,12 +572,8 @@ export type MessageRow = RowBase &
|
|
|
632
572
|
export type DataColumn = Readonly<{
|
|
633
573
|
key: string;
|
|
634
574
|
text: string;
|
|
635
|
-
textSegments?: readonly ValueTextSegment[];
|
|
636
|
-
titleIcon?: IdentityRow['titleIcon'];
|
|
637
|
-
secondaryTitleIcon?: IdentityRow['titleIcon'];
|
|
638
575
|
secondaryLeadingText?: string;
|
|
639
576
|
secondaryText?: string;
|
|
640
|
-
secondaryTextSegments?: readonly ValueTextSegment[];
|
|
641
577
|
weight?: 1 | 2 | 3;
|
|
642
578
|
alignment?: 'start' | 'center' | 'end';
|
|
643
579
|
tone?: 'primary' | 'secondary' | 'positive' | 'negative';
|
|
@@ -649,7 +585,6 @@ export type DataRow = RowBase &
|
|
|
649
585
|
type: 'dataRow';
|
|
650
586
|
leading?: LeadingVisual;
|
|
651
587
|
columns: readonly DataColumn[];
|
|
652
|
-
trailing?: readonly TrailingAccessory[];
|
|
653
588
|
checkbox?: Extract<TrailingAccessory, { kind: 'checkbox' }>;
|
|
654
589
|
index?: number;
|
|
655
590
|
badge?: BadgeModel;
|
|
@@ -831,11 +766,9 @@ export type SectionHeaderRow = RowBase &
|
|
|
831
766
|
indexTitle?: string;
|
|
832
767
|
variant?: 'summary' | 'gallery' | 'history';
|
|
833
768
|
title: string;
|
|
834
|
-
leadingBadge?: BadgeModel;
|
|
835
769
|
titleLoading?: boolean;
|
|
836
770
|
subtitle?: string;
|
|
837
771
|
value?: string;
|
|
838
|
-
valueHelp?: RowTextHelp;
|
|
839
772
|
valueActionKey?: string;
|
|
840
773
|
titleIcon?: Extract<TrailingAccessory, { kind: 'icon' }>;
|
|
841
774
|
valueIcon?: Extract<TrailingAccessory, { kind: 'icon' }>;
|
|
@@ -856,21 +789,6 @@ export type ActionRow = RowBase &
|
|
|
856
789
|
style?: ActionRowStyle;
|
|
857
790
|
}>;
|
|
858
791
|
|
|
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
|
-
|
|
874
792
|
export type SystemRow = RowBase &
|
|
875
793
|
Readonly<{ style?: SystemRowStyle }> &
|
|
876
794
|
(
|
|
@@ -923,7 +841,6 @@ export type RowModel =
|
|
|
923
841
|
| MetricCardRow
|
|
924
842
|
| SectionHeaderRow
|
|
925
843
|
| ActionRow
|
|
926
|
-
| ButtonGroupRow
|
|
927
844
|
| SystemRow;
|
|
928
845
|
|
|
929
846
|
export type NativeListTheme = Readonly<{
|
|
@@ -936,8 +853,6 @@ export type NativeListTheme = Readonly<{
|
|
|
936
853
|
rowBackground: string;
|
|
937
854
|
rowSelectedBackground: string;
|
|
938
855
|
rowPressedBackground?: string;
|
|
939
|
-
/** Web-only enabled-row hover color; defaults to rowPressedBackground. */
|
|
940
|
-
rowHoverBackground?: string;
|
|
941
856
|
subduedBackground?: string;
|
|
942
857
|
strongBackground?: string;
|
|
943
858
|
/** Web-only background for a displayed declared image fallback. */
|
|
@@ -950,8 +865,6 @@ export type NativeListTheme = Readonly<{
|
|
|
950
865
|
separator: string;
|
|
951
866
|
accent: string;
|
|
952
867
|
positive: string;
|
|
953
|
-
/** Optional exact background for the success tone of section leading badges. */
|
|
954
|
-
successBackground?: string;
|
|
955
868
|
negative: string;
|
|
956
869
|
criticalBackground?: string;
|
|
957
870
|
inverseBackground?: string;
|
|
@@ -998,12 +911,6 @@ export type NativeListListStyle = Readonly<{
|
|
|
998
911
|
export type NativeListSnapshot = Readonly<{
|
|
999
912
|
schemaVersion: 1;
|
|
1000
913
|
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
|
-
}>;
|
|
1007
914
|
layout: Readonly<{
|
|
1008
915
|
kind: NativeListLayout;
|
|
1009
916
|
orientation?: NativeListOrientation;
|
|
@@ -1061,13 +968,7 @@ export type RowPatch =
|
|
|
1061
968
|
IdentityRow,
|
|
1062
969
|
| CommonPatchFields
|
|
1063
970
|
| 'title'
|
|
1064
|
-
| 'titleSuffixes'
|
|
1065
|
-
| 'titleIcon'
|
|
1066
|
-
| 'secondaryTitleIcon'
|
|
1067
971
|
| 'subtitle'
|
|
1068
|
-
| 'subtitleLines'
|
|
1069
|
-
| 'contentHeight'
|
|
1070
|
-
| 'longPressActionKey'
|
|
1071
972
|
| 'tertiary'
|
|
1072
973
|
| 'tertiaryTone'
|
|
1073
974
|
| 'badges'
|
|
@@ -1109,7 +1010,6 @@ export type RowPatch =
|
|
|
1109
1010
|
| 'primaryAmount'
|
|
1110
1011
|
| 'secondaryAmount'
|
|
1111
1012
|
| 'leading'
|
|
1112
|
-
| 'hideLeading'
|
|
1113
1013
|
| 'secondaryLeading'
|
|
1114
1014
|
| 'footerActions'
|
|
1115
1015
|
>
|
|
@@ -1126,7 +1026,6 @@ export type RowPatch =
|
|
|
1126
1026
|
| 'title'
|
|
1127
1027
|
| 'body'
|
|
1128
1028
|
| 'bodyLines'
|
|
1129
|
-
| 'presentation'
|
|
1130
1029
|
| 'time'
|
|
1131
1030
|
| 'thumbnail'
|
|
1132
1031
|
>
|
|
@@ -1141,7 +1040,6 @@ export type RowPatch =
|
|
|
1141
1040
|
| CommonPatchFields
|
|
1142
1041
|
| 'leading'
|
|
1143
1042
|
| 'columns'
|
|
1144
|
-
| 'trailing'
|
|
1145
1043
|
| 'checkbox'
|
|
1146
1044
|
| 'index'
|
|
1147
1045
|
| 'badge'
|
|
@@ -1226,8 +1124,6 @@ export type RowPatch =
|
|
|
1226
1124
|
| 'title'
|
|
1227
1125
|
| 'subtitle'
|
|
1228
1126
|
| 'value'
|
|
1229
|
-
| 'valueHelp'
|
|
1230
|
-
| 'leadingBadge'
|
|
1231
1127
|
| 'valueActionKey'
|
|
1232
1128
|
| 'titleActionKey'
|
|
1233
1129
|
| 'titleActionOnHover'
|
|
@@ -1252,11 +1148,6 @@ export type RowPatch =
|
|
|
1252
1148
|
>
|
|
1253
1149
|
>;
|
|
1254
1150
|
}>
|
|
1255
|
-
| Readonly<{
|
|
1256
|
-
type: 'buttonGroup';
|
|
1257
|
-
key: string;
|
|
1258
|
-
changes: Partial<Pick<ButtonGroupRow, CommonPatchFields | 'buttons'>>;
|
|
1259
|
-
}>
|
|
1260
1151
|
| Readonly<{
|
|
1261
1152
|
type: 'system';
|
|
1262
1153
|
key: string;
|
|
@@ -1273,7 +1164,6 @@ export type NativeListActionSource =
|
|
|
1273
1164
|
| 'leadingAction'
|
|
1274
1165
|
| 'trailingAccessory'
|
|
1275
1166
|
| 'footerAction'
|
|
1276
|
-
| 'buttonGroup'
|
|
1277
1167
|
| 'description'
|
|
1278
1168
|
| 'mediaClose';
|
|
1279
1169
|
|