@onekeyfe/react-native-native-list 3.0.158 → 3.0.160
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 +21 -5
- package/android/build.gradle +7 -0
- package/android/src/main/java/com/onekey/nativelist/HybridNativeList.kt +20 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListAccessoryStack.kt +711 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListActionRenderer.kt +169 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListActivityDetailsView.kt +179 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListActivityRenderer.kt +264 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListAdapter.kt +20 -6
- package/android/src/main/java/com/onekey/nativelist/NativeListContainerSlotAdapter.kt +53 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListDataRowRenderer.kt +487 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListEndAlignment.kt +5 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListIdentityRenderer.kt +820 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListImageSlot.kt +147 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListLeadingVisual.kt +453 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListMarketRenderer.kt +997 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListMediaPreviewSlot.kt +268 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListMediaTileRenderer.kt +243 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListMessageRenderer.kt +232 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListMetricCardRenderer.kt +551 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListModels.kt +27 -1
- package/android/src/main/java/com/onekey/nativelist/NativeListPrimitives.kt +475 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListRailRenderer.kt +143 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListRendererRegistry.kt +42 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListRendererRowView.kt +415 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListResolvedText.kt +163 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListRowHost.kt +70 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListScrollPositionTracker.kt +59 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListSectionHeaderRenderer.kt +763 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListSystemRenderer.kt +464 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListTextView.kt +25 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListView.kt +432 -124
- package/android/src/main/java/com/onekey/nativelist/NativeListWalletGroupRenderer.kt +407 -0
- package/android/src/main/res/values/native_scroll_coordinator_ids.xml +5 -0
- package/android/src/test/java/com/margelo/nitro/nativelist/NativeListEndAlignmentTest.kt +34 -0
- package/android/src/test/java/com/margelo/nitro/nativelist/NativeListScrollPositionTrackerTest.kt +44 -0
- package/android/src/test/java/com/margelo/nitro/nativelist/NativeListSelectorBackgroundColorTest.kt +34 -0
- package/docs/DESIGN.md +520 -9
- package/docs/MIGRATION_BASELINE.md +117 -0
- package/docs/ROW_TEMPLATES.md +404 -0
- package/docs/SPEC.md +621 -0
- package/docs/STYLE_SPEC.md +988 -0
- package/docs/images/list-capabilities.svg +39 -0
- package/docs/images/row-action.svg +17 -0
- package/docs/images/row-activity.svg +24 -0
- package/docs/images/row-data.svg +24 -0
- package/docs/images/row-identity.svg +25 -0
- package/docs/images/row-market.svg +23 -0
- package/docs/images/row-media-tile.svg +26 -0
- package/docs/images/row-message.svg +20 -0
- package/docs/images/row-metric-card.svg +33 -0
- package/docs/images/row-rail.svg +18 -0
- package/docs/images/row-section-header.svg +19 -0
- package/docs/images/row-style-regions.svg +30 -0
- package/docs/images/row-system.svg +30 -0
- package/docs/images/row-wallet-group.svg +26 -0
- package/ios/HybridNativeList.swift +30 -0
- package/ios/NativeListAccessoryStack.swift +680 -0
- package/ios/NativeListActionRenderer.swift +108 -0
- package/ios/NativeListActivityDetailsView.swift +291 -0
- package/ios/NativeListActivityRenderer.swift +201 -0
- package/ios/NativeListDataRowRenderer.swift +444 -0
- package/ios/NativeListIdentityRenderer.swift +685 -0
- package/ios/NativeListImageSlot.swift +140 -0
- package/ios/NativeListLeadingVisual.swift +372 -0
- package/ios/NativeListMarketRenderer.swift +698 -0
- package/ios/NativeListMediaPreviewSlot.swift +259 -0
- package/ios/NativeListMediaTileRenderer.swift +190 -0
- package/ios/NativeListMessageRenderer.swift +168 -0
- package/ios/NativeListMetricCardRenderer.swift +420 -0
- package/ios/NativeListModels.swift +36 -1
- package/ios/NativeListRailRenderer.swift +152 -0
- package/ios/NativeListRendererCell.swift +311 -0
- package/ios/NativeListRendererRegistry.swift +50 -0
- package/ios/NativeListResolvedText.swift +130 -0
- package/ios/NativeListRowHost.swift +63 -0
- package/ios/NativeListScrollPositionTracker.swift +30 -0
- package/ios/NativeListSectionHeaderRenderer.swift +734 -0
- package/ios/NativeListSystemRenderer.swift +568 -0
- package/ios/NativeListTextLabel.swift +42 -0
- package/ios/NativeListTextStyles.swift +236 -0
- package/ios/NativeListWalletGroupRenderer.swift +255 -0
- package/ios/RNCNativeListView.swift +282 -184
- package/ios/tests/NativeListActivityPresentationTests.swift +97 -0
- package/ios/tests/NativeListLifecycleTests.swift +241 -0
- package/ios/tests/NativeListMediaVisibilityTests.swift +109 -0
- package/ios/tests/NativeListScrollPositionTrackerTests.swift +25 -0
- package/lib/module/NativeList.js +56 -3
- package/lib/module/NativeList.web.js +5 -0
- package/lib/module/models.js +54 -0
- package/lib/module/validation.js +386 -28
- package/lib/module/web/NativeListWebEngine.js +148 -936
- package/lib/module/web/templates/ActionRowRenderer.js +97 -0
- package/lib/module/web/templates/ActivityRowRenderer.js +95 -0
- package/lib/module/web/templates/DataRowRenderer.js +145 -0
- package/lib/module/web/templates/IdentityRowRenderer.js +289 -0
- package/lib/module/web/templates/MarketRowRenderer.js +310 -0
- package/lib/module/web/templates/MediaTileRowRenderer.js +132 -0
- package/lib/module/web/templates/MessageRowRenderer.js +165 -0
- package/lib/module/web/templates/MetricCardRowRenderer.js +172 -0
- package/lib/module/web/templates/RailRowRenderer.js +98 -0
- package/lib/module/web/templates/RowContainerStyle.js +100 -0
- package/lib/module/web/templates/RowElements.js +93 -0
- package/lib/module/web/templates/RowRendererRegistry.js +70 -0
- package/lib/module/web/templates/RowText.js +121 -0
- package/lib/module/web/templates/RowVisual.js +43 -0
- package/lib/module/web/templates/SectionHeaderRowRenderer.js +146 -0
- package/lib/module/web/templates/SystemRowRenderer.js +161 -0
- package/lib/module/web/templates/WalletGroupRowRenderer.js +96 -0
- package/lib/nitrogen/generated/android/c++/JFunc_void_bool.hpp +75 -0
- package/lib/nitrogen/generated/android/c++/JHybridNativeListSpec.cpp +39 -3
- package/lib/nitrogen/generated/android/c++/JHybridNativeListSpec.hpp +6 -0
- package/lib/nitrogen/generated/android/c++/views/JHybridNativeListStateUpdater.cpp +15 -0
- package/lib/nitrogen/generated/android/kotlin/com/margelo/nitro/nativelist/Func_void_bool.kt +78 -0
- package/lib/nitrogen/generated/android/kotlin/com/margelo/nitro/nativelist/HybridNativeListSpec.kt +26 -0
- package/lib/nitrogen/generated/android/kotlin/com/margelo/nitro/nativelist/views/HybridNativeListManager.kt +24 -9
- package/lib/nitrogen/generated/android/nativelistOnLoad.cpp +2 -0
- package/lib/nitrogen/generated/ios/NativeListModule-Swift-Cxx-Bridge.cpp +8 -0
- package/lib/nitrogen/generated/ios/NativeListModule-Swift-Cxx-Bridge.hpp +37 -0
- package/lib/nitrogen/generated/ios/c++/HybridNativeListSpecSwift.hpp +23 -2
- package/lib/nitrogen/generated/ios/c++/views/HybridNativeListComponent.mm +32 -0
- package/lib/nitrogen/generated/ios/swift/Func_void_bool.swift +46 -0
- package/lib/nitrogen/generated/ios/swift/HybridNativeListSpec.swift +3 -0
- package/lib/nitrogen/generated/ios/swift/HybridNativeListSpec_cxx.swift +54 -0
- package/lib/nitrogen/generated/shared/c++/HybridNativeListSpec.cpp +6 -0
- package/lib/nitrogen/generated/shared/c++/HybridNativeListSpec.hpp +8 -2
- package/lib/nitrogen/generated/shared/c++/views/HybridNativeListComponent.cpp +6 -0
- package/lib/nitrogen/generated/shared/c++/views/HybridNativeListComponent.hpp +11 -2
- package/lib/nitrogen/generated/shared/json/NativeListConfig.json +3 -0
- package/lib/typescript/src/NativeList.nitro.d.ts +3 -0
- package/lib/typescript/src/NativeList.types.d.ts +14 -1
- package/lib/typescript/src/models.d.ts +199 -18
- package/lib/typescript/src/web/NativeListWebEngine.d.ts +18 -16
- package/lib/typescript/src/web/templates/ActionRowRenderer.d.ts +15 -0
- package/lib/typescript/src/web/templates/ActivityRowRenderer.d.ts +15 -0
- package/lib/typescript/src/web/templates/DataRowRenderer.d.ts +15 -0
- package/lib/typescript/src/web/templates/IdentityRowRenderer.d.ts +16 -0
- package/lib/typescript/src/web/templates/MarketRowRenderer.d.ts +30 -0
- package/lib/typescript/src/web/templates/MediaTileRowRenderer.d.ts +15 -0
- package/lib/typescript/src/web/templates/MessageRowRenderer.d.ts +44 -0
- package/lib/typescript/src/web/templates/MetricCardRowRenderer.d.ts +15 -0
- package/lib/typescript/src/web/templates/RailRowRenderer.d.ts +28 -0
- package/lib/typescript/src/web/templates/RowContainerStyle.d.ts +9 -0
- package/lib/typescript/src/web/templates/RowElements.d.ts +38 -0
- package/lib/typescript/src/web/templates/RowRendererRegistry.d.ts +83 -0
- package/lib/typescript/src/web/templates/RowText.d.ts +9 -0
- package/lib/typescript/src/web/templates/RowVisual.d.ts +20 -0
- package/lib/typescript/src/web/templates/SectionHeaderRowRenderer.d.ts +15 -0
- package/lib/typescript/src/web/templates/SystemRowRenderer.d.ts +16 -0
- package/lib/typescript/src/web/templates/WalletGroupRowRenderer.d.ts +20 -0
- package/nitrogen/generated/android/c++/JFunc_void_bool.hpp +75 -0
- package/nitrogen/generated/android/c++/JHybridNativeListSpec.cpp +39 -3
- package/nitrogen/generated/android/c++/JHybridNativeListSpec.hpp +6 -0
- package/nitrogen/generated/android/c++/views/JHybridNativeListStateUpdater.cpp +15 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nativelist/Func_void_bool.kt +78 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nativelist/HybridNativeListSpec.kt +26 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nativelist/views/HybridNativeListManager.kt +24 -9
- package/nitrogen/generated/android/nativelistOnLoad.cpp +2 -0
- package/nitrogen/generated/ios/NativeListModule-Swift-Cxx-Bridge.cpp +8 -0
- package/nitrogen/generated/ios/NativeListModule-Swift-Cxx-Bridge.hpp +37 -0
- package/nitrogen/generated/ios/c++/HybridNativeListSpecSwift.hpp +23 -2
- package/nitrogen/generated/ios/c++/views/HybridNativeListComponent.mm +32 -0
- package/nitrogen/generated/ios/swift/Func_void_bool.swift +46 -0
- package/nitrogen/generated/ios/swift/HybridNativeListSpec.swift +3 -0
- package/nitrogen/generated/ios/swift/HybridNativeListSpec_cxx.swift +54 -0
- package/nitrogen/generated/shared/c++/HybridNativeListSpec.cpp +6 -0
- package/nitrogen/generated/shared/c++/HybridNativeListSpec.hpp +8 -2
- package/nitrogen/generated/shared/c++/views/HybridNativeListComponent.cpp +6 -0
- package/nitrogen/generated/shared/c++/views/HybridNativeListComponent.hpp +11 -2
- package/nitrogen/generated/shared/json/NativeListConfig.json +3 -0
- package/package.json +7 -6
- package/react-native-native-list.podspec +6 -0
- package/scripts/enable-container-slots.mjs +58 -0
- package/scripts/enable-container-slots.test.mjs +58 -0
- package/src/NativeList.nitro.ts +3 -0
- package/src/NativeList.tsx +84 -2
- package/src/NativeList.types.ts +14 -1
- package/src/NativeList.web.tsx +5 -0
- package/src/models.ts +320 -20
- package/src/validation.ts +641 -49
- package/src/web/NativeListWebEngine.ts +361 -1932
- package/src/web/templates/ActionRowRenderer.ts +123 -0
- package/src/web/templates/ActivityRowRenderer.ts +159 -0
- package/src/web/templates/DataRowRenderer.ts +212 -0
- package/src/web/templates/IdentityRowRenderer.ts +527 -0
- package/src/web/templates/MarketRowRenderer.ts +467 -0
- package/src/web/templates/MediaTileRowRenderer.ts +182 -0
- package/src/web/templates/MessageRowRenderer.ts +306 -0
- package/src/web/templates/MetricCardRowRenderer.ts +337 -0
- package/src/web/templates/RailRowRenderer.ts +136 -0
- package/src/web/templates/RowContainerStyle.ts +131 -0
- package/src/web/templates/RowElements.ts +160 -0
- package/src/web/templates/RowRendererRegistry.ts +111 -0
- package/src/web/templates/RowText.ts +181 -0
- package/src/web/templates/RowVisual.ts +115 -0
- package/src/web/templates/SectionHeaderRowRenderer.ts +243 -0
- package/src/web/templates/SystemRowRenderer.ts +282 -0
- package/src/web/templates/WalletGroupRowRenderer.ts +131 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListRowView.kt +0 -4538
- package/ios/NativeListCell.swift +0 -4300
package/src/NativeList.tsx
CHANGED
|
@@ -4,6 +4,7 @@ import React, {
|
|
|
4
4
|
useImperativeHandle,
|
|
5
5
|
useMemo,
|
|
6
6
|
useRef,
|
|
7
|
+
useState,
|
|
7
8
|
} from 'react';
|
|
8
9
|
import {
|
|
9
10
|
OneKeyImageCache,
|
|
@@ -13,6 +14,7 @@ import {
|
|
|
13
14
|
NativeAvatarPrefetchModel,
|
|
14
15
|
NativeAvatarPrefetchQueue,
|
|
15
16
|
} from './avatarPrefetch';
|
|
17
|
+
import { View } from 'react-native';
|
|
16
18
|
import { callback, getHostComponent } from 'react-native-nitro-modules';
|
|
17
19
|
import type {
|
|
18
20
|
NativeListMethods,
|
|
@@ -96,6 +98,10 @@ export const NativeList = forwardRef<NativeListRef, NativeListProps>(
|
|
|
96
98
|
function NativeList(
|
|
97
99
|
{
|
|
98
100
|
snapshot,
|
|
101
|
+
listHeader,
|
|
102
|
+
listFooter,
|
|
103
|
+
listEmpty,
|
|
104
|
+
scrollPositionThresholds,
|
|
99
105
|
webVirtualizationEnabled: _webVirtualizationEnabled,
|
|
100
106
|
webSectionIndexContainerRef: _webSectionIndexContainerRef,
|
|
101
107
|
keyboardDismissMode = 'none',
|
|
@@ -106,6 +112,7 @@ export const NativeList = forwardRef<NativeListRef, NativeListProps>(
|
|
|
106
112
|
onReorder,
|
|
107
113
|
onEndReached,
|
|
108
114
|
onVisibleRangeChanged,
|
|
115
|
+
onScrollPositionThresholdChange,
|
|
109
116
|
onRefresh,
|
|
110
117
|
onScrollToIndexFailed,
|
|
111
118
|
initialScrollIndex,
|
|
@@ -116,6 +123,21 @@ export const NativeList = forwardRef<NativeListRef, NativeListProps>(
|
|
|
116
123
|
},
|
|
117
124
|
forwardedRef
|
|
118
125
|
) {
|
|
126
|
+
const [slotHeights, setSlotHeights] = useState([0, 0, 0]);
|
|
127
|
+
const containerSlotHeightsJson = JSON.stringify(slotHeights);
|
|
128
|
+
const slotInset =
|
|
129
|
+
snapshot.layout.contentPaddingHorizontal ??
|
|
130
|
+
snapshot.layout.contentPadding ??
|
|
131
|
+
0;
|
|
132
|
+
if (
|
|
133
|
+
snapshot.layout.orientation === 'horizontal' &&
|
|
134
|
+
(listHeader || listEmpty || listFooter)
|
|
135
|
+
) {
|
|
136
|
+
throw new Error(
|
|
137
|
+
'NativeList container slots require vertical orientation'
|
|
138
|
+
);
|
|
139
|
+
}
|
|
140
|
+
const slotContents = [listHeader, listEmpty, listFooter];
|
|
119
141
|
const normalizedKeyboardShouldPersistTaps =
|
|
120
142
|
keyboardShouldPersistTaps === true
|
|
121
143
|
? 'always'
|
|
@@ -130,6 +152,7 @@ export const NativeList = forwardRef<NativeListRef, NativeListProps>(
|
|
|
130
152
|
onReorder,
|
|
131
153
|
onEndReached,
|
|
132
154
|
onVisibleRangeChanged,
|
|
155
|
+
onScrollPositionThresholdChange,
|
|
133
156
|
onRefresh,
|
|
134
157
|
onScrollToIndexFailed,
|
|
135
158
|
});
|
|
@@ -140,9 +163,29 @@ export const NativeList = forwardRef<NativeListRef, NativeListProps>(
|
|
|
140
163
|
onReorder,
|
|
141
164
|
onEndReached,
|
|
142
165
|
onVisibleRangeChanged,
|
|
166
|
+
onScrollPositionThresholdChange,
|
|
143
167
|
onRefresh,
|
|
144
168
|
onScrollToIndexFailed,
|
|
145
169
|
};
|
|
170
|
+
const scrollPositionThresholdsJson = useMemo(() => {
|
|
171
|
+
if (
|
|
172
|
+
!scrollPositionThresholds ||
|
|
173
|
+
scrollPositionThresholds.enabled === false
|
|
174
|
+
)
|
|
175
|
+
return '';
|
|
176
|
+
const { start, end } = scrollPositionThresholds;
|
|
177
|
+
if (
|
|
178
|
+
!Number.isFinite(start) ||
|
|
179
|
+
!Number.isFinite(end) ||
|
|
180
|
+
start < 0 ||
|
|
181
|
+
end <= start
|
|
182
|
+
) {
|
|
183
|
+
throw new Error(
|
|
184
|
+
'scrollPositionThresholds requires 0 <= start < end and finite values'
|
|
185
|
+
);
|
|
186
|
+
}
|
|
187
|
+
return JSON.stringify({ start, end });
|
|
188
|
+
}, [scrollPositionThresholds]);
|
|
146
189
|
const snapshotJson = useMemo(() => serializeSnapshot(snapshot), [snapshot]);
|
|
147
190
|
const snapshotRef = useRef(snapshot);
|
|
148
191
|
const previousSnapshotJsonRef = useRef(snapshotJson);
|
|
@@ -391,8 +434,13 @@ export const NativeList = forwardRef<NativeListRef, NativeListProps>(
|
|
|
391
434
|
}),
|
|
392
435
|
onRowAction: callback((payloadJson: string) => {
|
|
393
436
|
const payload = parsePayload<RowActionEvent>(payloadJson);
|
|
394
|
-
if (
|
|
437
|
+
if (
|
|
438
|
+
payload.actionKey === 'nativeList.refresh' &&
|
|
439
|
+
payload.rowKey === undefined
|
|
440
|
+
) {
|
|
395
441
|
callbacksRef.current.onRefresh?.();
|
|
442
|
+
return;
|
|
443
|
+
}
|
|
396
444
|
callbacksRef.current.onRowAction?.(payload);
|
|
397
445
|
}),
|
|
398
446
|
onActionAnchorInvalidated: callback((payloadJson: string) => {
|
|
@@ -427,6 +475,13 @@ export const NativeList = forwardRef<NativeListRef, NativeListProps>(
|
|
|
427
475
|
parsePayload<EndReachedEvent>(payloadJson)
|
|
428
476
|
);
|
|
429
477
|
}),
|
|
478
|
+
onScrollPositionThresholdChange: callback(
|
|
479
|
+
(isBeyondThreshold: boolean) => {
|
|
480
|
+
callbacksRef.current.onScrollPositionThresholdChange?.({
|
|
481
|
+
isBeyondThreshold,
|
|
482
|
+
});
|
|
483
|
+
}
|
|
484
|
+
),
|
|
430
485
|
onVisibleRangeChanged: callback((payloadJson: string) => {
|
|
431
486
|
const payload = parsePayload<VisibleRangeChangedEvent>(payloadJson);
|
|
432
487
|
const previous = avatarRangeRef.current;
|
|
@@ -450,9 +505,36 @@ export const NativeList = forwardRef<NativeListRef, NativeListProps>(
|
|
|
450
505
|
{...viewProps}
|
|
451
506
|
{...nativeCallbacks}
|
|
452
507
|
snapshotJson={snapshotJson}
|
|
508
|
+
containerSlotHeightsJson={containerSlotHeightsJson}
|
|
509
|
+
scrollPositionThresholdsJson={scrollPositionThresholdsJson}
|
|
453
510
|
keyboardDismissMode={keyboardDismissMode}
|
|
454
511
|
keyboardShouldPersistTaps={normalizedKeyboardShouldPersistTaps}
|
|
455
|
-
|
|
512
|
+
>
|
|
513
|
+
{slotContents.map((content, index) => (
|
|
514
|
+
<View
|
|
515
|
+
key={index}
|
|
516
|
+
collapsable={false}
|
|
517
|
+
style={{
|
|
518
|
+
position: 'absolute',
|
|
519
|
+
left: slotInset,
|
|
520
|
+
right: slotInset,
|
|
521
|
+
top: 0,
|
|
522
|
+
}}
|
|
523
|
+
onLayout={(event) => {
|
|
524
|
+
const height = Math.ceil(event.nativeEvent.layout.height);
|
|
525
|
+
setSlotHeights((previous) =>
|
|
526
|
+
previous[index] === height
|
|
527
|
+
? previous
|
|
528
|
+
: previous.map((value, slot) =>
|
|
529
|
+
slot === index ? height : value
|
|
530
|
+
)
|
|
531
|
+
);
|
|
532
|
+
}}
|
|
533
|
+
>
|
|
534
|
+
{content}
|
|
535
|
+
</View>
|
|
536
|
+
))}
|
|
537
|
+
</NativeListHost>
|
|
456
538
|
);
|
|
457
539
|
}
|
|
458
540
|
);
|
package/src/NativeList.types.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { RefObject } from 'react';
|
|
1
|
+
import type { ReactNode, RefObject } from 'react';
|
|
2
2
|
import type { View, ViewProps } from 'react-native';
|
|
3
3
|
import type {
|
|
4
4
|
ActionAnchorInvalidatedEvent,
|
|
@@ -119,6 +119,10 @@ export type NativeListRef = Readonly<{
|
|
|
119
119
|
export type NativeListProps = Omit<ViewProps, 'children'> &
|
|
120
120
|
Readonly<{
|
|
121
121
|
snapshot: NativeListSnapshot;
|
|
122
|
+
/** Native-only, container-owned scroll content. Never rendered as a data row. */
|
|
123
|
+
listHeader?: ReactNode;
|
|
124
|
+
listFooter?: ReactNode;
|
|
125
|
+
listEmpty?: ReactNode;
|
|
122
126
|
/** Web only. Defaults to true and is ignored by the native host. */
|
|
123
127
|
webVirtualizationEnabled?: boolean;
|
|
124
128
|
/** Web only. Hosts the section index inside this container. */
|
|
@@ -136,6 +140,15 @@ export type NativeListProps = Omit<ViewProps, 'children'> &
|
|
|
136
140
|
onReorder?: (event: ReorderEvent) => void;
|
|
137
141
|
onEndReached?: (event: EndReachedEvent) => void;
|
|
138
142
|
onVisibleRangeChanged?: (event: VisibleRangeChangedEvent) => void;
|
|
143
|
+
/** Native only. Emits initial state and hysteresis transitions, not scroll frames. */
|
|
144
|
+
scrollPositionThresholds?: Readonly<{
|
|
145
|
+
start: number;
|
|
146
|
+
end: number;
|
|
147
|
+
enabled?: boolean;
|
|
148
|
+
}>;
|
|
149
|
+
onScrollPositionThresholdChange?: (
|
|
150
|
+
event: Readonly<{ isBeyondThreshold: boolean }>
|
|
151
|
+
) => void;
|
|
139
152
|
onRefresh?: () => void;
|
|
140
153
|
onScrollToIndexFailed?: (info: ScrollToIndexFailedInfo) => void;
|
|
141
154
|
}> &
|
package/src/NativeList.web.tsx
CHANGED
|
@@ -82,6 +82,11 @@ export const NativeList = forwardRef<NativeListRef, NativeListProps>(
|
|
|
82
82
|
function NativeList(
|
|
83
83
|
{
|
|
84
84
|
snapshot,
|
|
85
|
+
listHeader: _listHeader,
|
|
86
|
+
listEmpty: _listEmpty,
|
|
87
|
+
listFooter: _listFooter,
|
|
88
|
+
scrollPositionThresholds: _scrollPositionThresholds,
|
|
89
|
+
onScrollPositionThresholdChange: _onScrollPositionThresholdChange,
|
|
85
90
|
webVirtualizationEnabled = true,
|
|
86
91
|
webSectionIndexContainerRef,
|
|
87
92
|
keyboardDismissMode: _keyboardDismissMode,
|