@legendapp/list 3.0.0-beta.36 → 3.0.0-beta.38
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/animated.d.ts +5 -4
- package/index.d.ts +7 -7
- package/index.js +151 -68
- package/index.mjs +151 -68
- package/index.native.js +162 -85
- package/index.native.mjs +144 -67
- package/keyboard-test.d.ts +204 -0
- package/keyboard-test.js +34 -0
- package/keyboard-test.mjs +13 -0
- package/keyboard.d.ts +2 -2
- package/keyboard.js +35 -31
- package/keyboard.mjs +31 -27
- package/package.json +6 -6
- package/react-native.d.ts +8 -8
- package/react-native.js +170 -85
- package/react-native.mjs +152 -68
- package/react.d.ts +7 -7
- package/react.js +151 -68
- package/react.mjs +151 -68
- package/reanimated.d.ts +23 -12
- package/reanimated.js +48 -132
- package/reanimated.mjs +42 -126
- package/section-list.d.ts +16 -16
- package/keyboard-controller.d.ts +0 -622
- package/keyboard-controller.js +0 -69
- package/keyboard-controller.mjs +0 -48
package/animated.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { Key } from 'react';
|
|
2
3
|
import { ScrollViewProps, NativeSyntheticEvent as NativeSyntheticEvent$1, NativeScrollEvent as NativeScrollEvent$1, ScrollView, StyleProp as StyleProp$1, ViewStyle as ViewStyle$1, ScrollViewComponent, ScrollResponderMixin, Insets as Insets$1, Animated } from 'react-native';
|
|
3
4
|
|
|
4
5
|
type ListenerType = "activeStickyIndex" | "debugComputedScroll" | "debugRawScroll" | "extraData" | "footerSize" | "headerSize" | "lastItemKeys" | "lastPositionUpdate" | "maintainVisibleContentPosition" | "numColumns" | "numContainers" | "numContainersPooled" | "otherAxisSize" | "readyToRender" | "scrollAdjust" | "scrollAdjustPending" | "scrollAdjustUserOffset" | "scrollSize" | "snapToOffsets" | "stylePaddingTop" | "totalSize" | `containerColumn${number}` | `containerSpan${number}` | `containerItemData${number}` | `containerItemKey${number}` | `containerPosition${number}` | `containerSticky${number}`;
|
|
@@ -84,7 +85,7 @@ interface DataModeProps<ItemT, TItemType extends string | undefined> {
|
|
|
84
85
|
* - A React component: React.ComponentType<LegendListRenderItemProps<ItemT>>
|
|
85
86
|
* @required when using data mode
|
|
86
87
|
*/
|
|
87
|
-
renderItem: ((props: LegendListRenderItemProps<ItemT, TItemType>) => ReactNode) | React.ComponentType<LegendListRenderItemProps<ItemT, TItemType>>;
|
|
88
|
+
renderItem: ((props: LegendListRenderItemProps<ItemT, TItemType>) => React.ReactNode) | React.ComponentType<LegendListRenderItemProps<ItemT, TItemType>>;
|
|
88
89
|
children?: never;
|
|
89
90
|
}
|
|
90
91
|
interface ChildrenModeProps {
|
|
@@ -93,7 +94,7 @@ interface ChildrenModeProps {
|
|
|
93
94
|
* Each child will be treated as an individual list item.
|
|
94
95
|
* @required when using children mode
|
|
95
96
|
*/
|
|
96
|
-
children: ReactNode;
|
|
97
|
+
children: React.ReactNode;
|
|
97
98
|
data?: never;
|
|
98
99
|
renderItem?: never;
|
|
99
100
|
}
|
|
@@ -591,7 +592,7 @@ interface ViewabilityConfig {
|
|
|
591
592
|
type LegendListPropsOverrides<ItemT, TItemType extends string | undefined> = Omit<LegendListPropsBase<ItemT, ScrollViewProps, TItemType>, "onScroll" | "refScrollView" | "renderScrollComponent" | "ListHeaderComponentStyle" | "ListFooterComponentStyle"> & {
|
|
592
593
|
onScroll?: (event: NativeSyntheticEvent$1<NativeScrollEvent$1>) => void;
|
|
593
594
|
refScrollView?: React.Ref<ScrollView>;
|
|
594
|
-
renderScrollComponent?: (props: ScrollViewProps) => ReactElement<ScrollViewProps>;
|
|
595
|
+
renderScrollComponent?: (props: ScrollViewProps) => React.ReactElement<ScrollViewProps>;
|
|
595
596
|
ListHeaderComponentStyle?: StyleProp$1<ViewStyle$1> | undefined;
|
|
596
597
|
ListFooterComponentStyle?: StyleProp$1<ViewStyle$1> | undefined;
|
|
597
598
|
};
|
package/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import * as React
|
|
2
|
-
import { Key,
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { Key, ComponentType, ReactNode, CSSProperties, Ref, ReactElement, JSXElementConstructor, RefAttributes, Dispatch, SetStateAction } from 'react';
|
|
3
3
|
|
|
4
4
|
type AnimatedValue = number;
|
|
5
5
|
|
|
@@ -68,7 +68,7 @@ interface StateContext {
|
|
|
68
68
|
positionListeners: Map<string, Set<(value: any) => void>>;
|
|
69
69
|
state: InternalState$1;
|
|
70
70
|
values: Map<ListenerType, any>;
|
|
71
|
-
viewRefs: Map<number, React
|
|
71
|
+
viewRefs: Map<number, React.RefObject<LooseView | null>>;
|
|
72
72
|
}
|
|
73
73
|
|
|
74
74
|
declare class ScrollAdjustHandler {
|
|
@@ -158,7 +158,7 @@ interface DataModeProps<ItemT, TItemType extends string | undefined> {
|
|
|
158
158
|
* - A React component: React.ComponentType<LegendListRenderItemProps<ItemT>>
|
|
159
159
|
* @required when using data mode
|
|
160
160
|
*/
|
|
161
|
-
renderItem: ((props: LegendListRenderItemProps$1<ItemT, TItemType>) => ReactNode) | React.ComponentType<LegendListRenderItemProps$1<ItemT, TItemType>>;
|
|
161
|
+
renderItem: ((props: LegendListRenderItemProps$1<ItemT, TItemType>) => React.ReactNode) | React.ComponentType<LegendListRenderItemProps$1<ItemT, TItemType>>;
|
|
162
162
|
children?: never;
|
|
163
163
|
}
|
|
164
164
|
interface ChildrenModeProps {
|
|
@@ -167,7 +167,7 @@ interface ChildrenModeProps {
|
|
|
167
167
|
* Each child will be treated as an individual list item.
|
|
168
168
|
* @required when using children mode
|
|
169
169
|
*/
|
|
170
|
-
children: ReactNode;
|
|
170
|
+
children: React.ReactNode;
|
|
171
171
|
data?: never;
|
|
172
172
|
renderItem?: never;
|
|
173
173
|
}
|
|
@@ -849,9 +849,9 @@ interface LegendListRecyclingState$1<T> {
|
|
|
849
849
|
prevIndex: number | undefined;
|
|
850
850
|
prevItem: T | undefined;
|
|
851
851
|
}
|
|
852
|
-
type TypedForwardRef$1 = <T, P = {}>(render: (props: P, ref: React.Ref<T>) => React.
|
|
852
|
+
type TypedForwardRef$1 = <T, P = {}>(render: (props: P, ref: React.Ref<T>) => React.ReactElement | null) => (props: P & React.RefAttributes<T>) => React.ReactElement | null;
|
|
853
853
|
declare const typedForwardRef: TypedForwardRef$1;
|
|
854
|
-
type TypedMemo$1 = <T extends React.ComponentType<any>>(Component: T, propsAreEqual?: (prevProps: Readonly<React.
|
|
854
|
+
type TypedMemo$1 = <T extends React.ComponentType<any>>(Component: T, propsAreEqual?: (prevProps: Readonly<React.ComponentProps<T>>, nextProps: Readonly<React.ComponentProps<T>>) => boolean) => T & {
|
|
855
855
|
displayName?: string;
|
|
856
856
|
};
|
|
857
857
|
declare const typedMemo: TypedMemo$1;
|
package/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
var React3 = require('react');
|
|
4
4
|
var shim = require('use-sync-external-store/shim');
|
|
5
|
-
var
|
|
5
|
+
var ReactDOM = require('react-dom');
|
|
6
6
|
|
|
7
7
|
function _interopNamespace(e) {
|
|
8
8
|
if (e && e.__esModule) return e;
|
|
@@ -23,6 +23,7 @@ function _interopNamespace(e) {
|
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
var React3__namespace = /*#__PURE__*/_interopNamespace(React3);
|
|
26
|
+
var ReactDOM__namespace = /*#__PURE__*/_interopNamespace(ReactDOM);
|
|
26
27
|
|
|
27
28
|
// src/components/LegendList.tsx
|
|
28
29
|
React3.forwardRef(function AnimatedView2(props, ref) {
|
|
@@ -251,8 +252,8 @@ var IS_DEV = (_a2 = processDev != null ? processDev : metroDev) != null ? _a2 :
|
|
|
251
252
|
var POSITION_OUT_OF_VIEW = -1e7;
|
|
252
253
|
var ENABLE_DEVMODE = IS_DEV && false;
|
|
253
254
|
var ENABLE_DEBUG_VIEW = IS_DEV && false;
|
|
254
|
-
var typedForwardRef =
|
|
255
|
-
var typedMemo =
|
|
255
|
+
var typedForwardRef = React3__namespace.forwardRef;
|
|
256
|
+
var typedMemo = React3__namespace.memo;
|
|
256
257
|
|
|
257
258
|
// src/utils/helpers.ts
|
|
258
259
|
function isFunction(obj) {
|
|
@@ -367,7 +368,16 @@ var PositionViewSticky = typedMemo(function PositionViewSticky2({
|
|
|
367
368
|
}
|
|
368
369
|
return styleBase;
|
|
369
370
|
}, [composed, horizontal, position, index, activeStickyIndex, stickyHeaderConfig == null ? void 0 : stickyHeaderConfig.offset]);
|
|
370
|
-
return /* @__PURE__ */ React3__namespace.createElement(
|
|
371
|
+
return /* @__PURE__ */ React3__namespace.createElement(
|
|
372
|
+
"div",
|
|
373
|
+
{
|
|
374
|
+
"data-index": index,
|
|
375
|
+
ref: refView,
|
|
376
|
+
style: viewStyle,
|
|
377
|
+
...webProps
|
|
378
|
+
},
|
|
379
|
+
children
|
|
380
|
+
);
|
|
371
381
|
});
|
|
372
382
|
var PositionView = PositionViewState;
|
|
373
383
|
function useInit(cb) {
|
|
@@ -633,13 +643,22 @@ var Platform = {
|
|
|
633
643
|
OS: "web"
|
|
634
644
|
};
|
|
635
645
|
|
|
636
|
-
// src/utils/
|
|
637
|
-
function
|
|
646
|
+
// src/utils/hasActiveMVCPAnchorLock.ts
|
|
647
|
+
function hasActiveMVCPAnchorLock(state) {
|
|
638
648
|
const lock = state.mvcpAnchorLock;
|
|
639
|
-
if (lock
|
|
649
|
+
if (!lock) {
|
|
650
|
+
return false;
|
|
651
|
+
}
|
|
652
|
+
if (Date.now() > lock.expiresAt) {
|
|
640
653
|
state.mvcpAnchorLock = void 0;
|
|
654
|
+
return false;
|
|
641
655
|
}
|
|
642
|
-
return
|
|
656
|
+
return true;
|
|
657
|
+
}
|
|
658
|
+
|
|
659
|
+
// src/utils/isInMVCPActiveMode.ts
|
|
660
|
+
function isInMVCPActiveMode(state) {
|
|
661
|
+
return state.dataChangeNeedsScrollUpdate || hasActiveMVCPAnchorLock(state);
|
|
643
662
|
}
|
|
644
663
|
|
|
645
664
|
// src/components/Container.tsx
|
|
@@ -1346,7 +1365,7 @@ function SnapWrapper({ ScrollComponent, ...props }) {
|
|
|
1346
1365
|
return /* @__PURE__ */ React3__namespace.createElement(ScrollComponent, { ...props, snapToOffsets });
|
|
1347
1366
|
}
|
|
1348
1367
|
var LayoutView = ({ onLayoutChange, refView, children, ...rest }) => {
|
|
1349
|
-
const ref = refView != null ? refView : React3.useRef();
|
|
1368
|
+
const ref = refView != null ? refView : React3.useRef(null);
|
|
1350
1369
|
useOnLayoutSync({ onLayoutChange, ref });
|
|
1351
1370
|
return /* @__PURE__ */ React3__namespace.createElement("div", { ...rest, ref }, children);
|
|
1352
1371
|
};
|
|
@@ -1382,8 +1401,8 @@ var ListComponent = typedMemo(function ListComponent2({
|
|
|
1382
1401
|
updateItemSize: updateItemSize2,
|
|
1383
1402
|
refScrollView,
|
|
1384
1403
|
renderScrollComponent,
|
|
1404
|
+
onLayoutFooter,
|
|
1385
1405
|
scrollAdjustHandler,
|
|
1386
|
-
onLayoutHeader,
|
|
1387
1406
|
snapToIndices,
|
|
1388
1407
|
stickyHeaderConfig,
|
|
1389
1408
|
stickyHeaderIndices,
|
|
@@ -1407,6 +1426,21 @@ var ListComponent = typedMemo(function ListComponent2({
|
|
|
1407
1426
|
set$(ctx, "footerSize", 0);
|
|
1408
1427
|
}
|
|
1409
1428
|
}, [ListHeaderComponent, ListFooterComponent, ctx]);
|
|
1429
|
+
const onLayoutHeader = React3.useCallback(
|
|
1430
|
+
(rect) => {
|
|
1431
|
+
const size = rect[horizontal ? "width" : "height"];
|
|
1432
|
+
set$(ctx, "headerSize", size);
|
|
1433
|
+
},
|
|
1434
|
+
[ctx, horizontal]
|
|
1435
|
+
);
|
|
1436
|
+
const onLayoutFooterInternal = React3.useCallback(
|
|
1437
|
+
(rect, fromLayoutEffect) => {
|
|
1438
|
+
const size = rect[horizontal ? "width" : "height"];
|
|
1439
|
+
set$(ctx, "footerSize", size);
|
|
1440
|
+
onLayoutFooter == null ? void 0 : onLayoutFooter(rect, fromLayoutEffect);
|
|
1441
|
+
},
|
|
1442
|
+
[ctx, horizontal, onLayoutFooter]
|
|
1443
|
+
);
|
|
1410
1444
|
return /* @__PURE__ */ React3__namespace.createElement(
|
|
1411
1445
|
SnapOrScroll,
|
|
1412
1446
|
{
|
|
@@ -1442,17 +1476,7 @@ var ListComponent = typedMemo(function ListComponent2({
|
|
|
1442
1476
|
waitForInitialLayout
|
|
1443
1477
|
}
|
|
1444
1478
|
),
|
|
1445
|
-
ListFooterComponent && /* @__PURE__ */ React3__namespace.createElement(
|
|
1446
|
-
LayoutView,
|
|
1447
|
-
{
|
|
1448
|
-
onLayoutChange: (layout) => {
|
|
1449
|
-
const size = layout[horizontal ? "width" : "height"];
|
|
1450
|
-
set$(ctx, "footerSize", size);
|
|
1451
|
-
},
|
|
1452
|
-
style: ListFooterComponentStyle
|
|
1453
|
-
},
|
|
1454
|
-
getComponent(ListFooterComponent)
|
|
1455
|
-
),
|
|
1479
|
+
ListFooterComponent && /* @__PURE__ */ React3__namespace.createElement(LayoutView, { onLayoutChange: onLayoutFooterInternal, style: ListFooterComponentStyle }, getComponent(ListFooterComponent)),
|
|
1456
1480
|
IS_DEV && ENABLE_DEVMODE
|
|
1457
1481
|
);
|
|
1458
1482
|
});
|
|
@@ -1460,19 +1484,12 @@ var ListComponent = typedMemo(function ListComponent2({
|
|
|
1460
1484
|
// src/core/calculateOffsetForIndex.ts
|
|
1461
1485
|
function calculateOffsetForIndex(ctx, index) {
|
|
1462
1486
|
const state = ctx.state;
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
}
|
|
1470
|
-
const headerSize = peek$(ctx, "headerSize");
|
|
1471
|
-
if (headerSize) {
|
|
1472
|
-
position += headerSize;
|
|
1473
|
-
}
|
|
1474
|
-
}
|
|
1475
|
-
return position;
|
|
1487
|
+
return index !== void 0 ? state.positions[index] || 0 : 0;
|
|
1488
|
+
}
|
|
1489
|
+
|
|
1490
|
+
// src/core/getTopOffsetAdjustment.ts
|
|
1491
|
+
function getTopOffsetAdjustment(ctx) {
|
|
1492
|
+
return (peek$(ctx, "stylePaddingTop") || 0) + (peek$(ctx, "headerSize") || 0);
|
|
1476
1493
|
}
|
|
1477
1494
|
|
|
1478
1495
|
// src/utils/getId.ts
|
|
@@ -1578,10 +1595,20 @@ function calculateOffsetWithOffsetPosition(ctx, offsetParam, params) {
|
|
|
1578
1595
|
if (viewOffset) {
|
|
1579
1596
|
offset -= viewOffset;
|
|
1580
1597
|
}
|
|
1598
|
+
if (index !== void 0) {
|
|
1599
|
+
const topOffsetAdjustment = getTopOffsetAdjustment(ctx);
|
|
1600
|
+
if (topOffsetAdjustment) {
|
|
1601
|
+
offset += topOffsetAdjustment;
|
|
1602
|
+
}
|
|
1603
|
+
}
|
|
1581
1604
|
if (viewPosition !== void 0 && index !== void 0) {
|
|
1582
1605
|
const itemSize = getItemSize(ctx, getId(state, index), index, state.props.data[index]);
|
|
1583
1606
|
const trailingInset = getContentInsetEnd(state);
|
|
1584
1607
|
offset -= viewPosition * (state.scrollLength - trailingInset - itemSize);
|
|
1608
|
+
if (index === state.props.data.length - 1) {
|
|
1609
|
+
const footerSize = peek$(ctx, "footerSize") || 0;
|
|
1610
|
+
offset += footerSize;
|
|
1611
|
+
}
|
|
1585
1612
|
}
|
|
1586
1613
|
return offset;
|
|
1587
1614
|
}
|
|
@@ -1957,7 +1984,7 @@ function updateScroll(ctx, newScroll, forceUpdate) {
|
|
|
1957
1984
|
checkThresholds(ctx);
|
|
1958
1985
|
};
|
|
1959
1986
|
if (scrollLength > 0 && scrollingTo === void 0 && scrollDelta > scrollLength) {
|
|
1960
|
-
|
|
1987
|
+
ReactDOM.flushSync(runCalculateItems);
|
|
1961
1988
|
} else {
|
|
1962
1989
|
runCalculateItems();
|
|
1963
1990
|
}
|
|
@@ -2674,6 +2701,8 @@ function maybeUpdateViewabilityCallback(ctx, configId, containerId, viewToken) {
|
|
|
2674
2701
|
const cb = ctx.mapViewabilityCallbacks.get(key);
|
|
2675
2702
|
cb == null ? void 0 : cb(viewToken);
|
|
2676
2703
|
}
|
|
2704
|
+
var unstableBatchedUpdates = ReactDOM__namespace.unstable_batchedUpdates;
|
|
2705
|
+
var batchedUpdates = typeof unstableBatchedUpdates === "function" ? unstableBatchedUpdates : (fn) => fn();
|
|
2677
2706
|
|
|
2678
2707
|
// src/utils/checkAllSizesKnown.ts
|
|
2679
2708
|
function isNullOrUndefined2(value) {
|
|
@@ -2926,7 +2955,7 @@ function handleStickyRecycling(ctx, stickyArray, scroll, drawDistance, currentSt
|
|
|
2926
2955
|
}
|
|
2927
2956
|
function calculateItemsInView(ctx, params = {}) {
|
|
2928
2957
|
const state = ctx.state;
|
|
2929
|
-
|
|
2958
|
+
batchedUpdates(() => {
|
|
2930
2959
|
var _a3, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
|
|
2931
2960
|
const {
|
|
2932
2961
|
columns,
|
|
@@ -3888,17 +3917,53 @@ function createColumnWrapperStyle(contentContainerStyle) {
|
|
|
3888
3917
|
// src/utils/createImperativeHandle.ts
|
|
3889
3918
|
function createImperativeHandle(ctx) {
|
|
3890
3919
|
const state = ctx.state;
|
|
3920
|
+
const IMPERATIVE_SCROLL_SETTLE_MAX_WAIT_MS = 800;
|
|
3921
|
+
const IMPERATIVE_SCROLL_SETTLE_STABLE_FRAMES = 2;
|
|
3922
|
+
let imperativeScrollToken = 0;
|
|
3923
|
+
const isSettlingAfterDataChange = () => !!state.didDataChange || !!state.didColumnsChange || state.queuedMVCPRecalculate !== void 0 || state.ignoreScrollFromMVCP !== void 0 || hasActiveMVCPAnchorLock(state);
|
|
3924
|
+
const runWhenSettled = (token, run) => {
|
|
3925
|
+
const startedAt = Date.now();
|
|
3926
|
+
let stableFrames = 0;
|
|
3927
|
+
const check = () => {
|
|
3928
|
+
if (token !== imperativeScrollToken) {
|
|
3929
|
+
return;
|
|
3930
|
+
}
|
|
3931
|
+
if (isSettlingAfterDataChange()) {
|
|
3932
|
+
stableFrames = 0;
|
|
3933
|
+
} else {
|
|
3934
|
+
stableFrames += 1;
|
|
3935
|
+
}
|
|
3936
|
+
const timedOut = Date.now() - startedAt >= IMPERATIVE_SCROLL_SETTLE_MAX_WAIT_MS;
|
|
3937
|
+
if (stableFrames >= IMPERATIVE_SCROLL_SETTLE_STABLE_FRAMES || timedOut) {
|
|
3938
|
+
run();
|
|
3939
|
+
return;
|
|
3940
|
+
}
|
|
3941
|
+
requestAnimationFrame(check);
|
|
3942
|
+
};
|
|
3943
|
+
requestAnimationFrame(check);
|
|
3944
|
+
};
|
|
3891
3945
|
const runScrollWithPromise = (run) => new Promise((resolve) => {
|
|
3892
3946
|
var _a3;
|
|
3947
|
+
const token = ++imperativeScrollToken;
|
|
3893
3948
|
(_a3 = state.pendingScrollResolve) == null ? void 0 : _a3.call(state);
|
|
3894
3949
|
state.pendingScrollResolve = resolve;
|
|
3895
|
-
const
|
|
3896
|
-
|
|
3897
|
-
|
|
3898
|
-
state.pendingScrollResolve = void 0;
|
|
3950
|
+
const runNow = () => {
|
|
3951
|
+
if (token !== imperativeScrollToken) {
|
|
3952
|
+
return;
|
|
3899
3953
|
}
|
|
3900
|
-
|
|
3954
|
+
const didStartScroll = run();
|
|
3955
|
+
if (!didStartScroll || !state.scrollingTo) {
|
|
3956
|
+
if (state.pendingScrollResolve === resolve) {
|
|
3957
|
+
state.pendingScrollResolve = void 0;
|
|
3958
|
+
}
|
|
3959
|
+
resolve();
|
|
3960
|
+
}
|
|
3961
|
+
};
|
|
3962
|
+
if (isSettlingAfterDataChange()) {
|
|
3963
|
+
runWhenSettled(token, runNow);
|
|
3964
|
+
return;
|
|
3901
3965
|
}
|
|
3966
|
+
runNow();
|
|
3902
3967
|
});
|
|
3903
3968
|
const scrollIndexIntoView = (options) => {
|
|
3904
3969
|
if (state) {
|
|
@@ -4208,7 +4273,7 @@ var LegendList = typedMemo(
|
|
|
4208
4273
|
})
|
|
4209
4274
|
);
|
|
4210
4275
|
var LegendListInner = typedForwardRef(function LegendListInner2(props, forwardedRef) {
|
|
4211
|
-
var _a3, _b, _c, _d;
|
|
4276
|
+
var _a3, _b, _c, _d, _e;
|
|
4212
4277
|
const {
|
|
4213
4278
|
alignItemsAtEnd = false,
|
|
4214
4279
|
alwaysRender,
|
|
@@ -4297,7 +4362,6 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
4297
4362
|
const maintainVisibleContentPositionConfig = normalizeMaintainVisibleContentPosition(
|
|
4298
4363
|
maintainVisibleContentPositionProp
|
|
4299
4364
|
);
|
|
4300
|
-
const [renderNum, setRenderNum] = React3.useState(0);
|
|
4301
4365
|
const initialScrollProp = initialScrollAtEnd ? { index: Math.max(0, dataProp.length - 1), viewOffset: -stylePaddingBottomState, viewPosition: 1 } : initialScrollIndexProp || initialScrollOffsetProp ? typeof initialScrollIndexProp === "object" ? {
|
|
4302
4366
|
index: initialScrollIndexProp.index || 0,
|
|
4303
4367
|
viewOffset: initialScrollIndexProp.viewOffset || (initialScrollIndexProp.viewPosition === 1 ? -stylePaddingBottomState : 0),
|
|
@@ -4338,7 +4402,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
4338
4402
|
);
|
|
4339
4403
|
}
|
|
4340
4404
|
const useWindowScrollResolved = !!useWindowScroll && !renderScrollComponent;
|
|
4341
|
-
const refState = React3.useRef();
|
|
4405
|
+
const refState = React3.useRef(void 0);
|
|
4342
4406
|
const hasOverrideItemLayout = !!overrideItemLayout;
|
|
4343
4407
|
const prevHasOverrideItemLayout = React3.useRef(hasOverrideItemLayout);
|
|
4344
4408
|
if (!refState.current) {
|
|
@@ -4497,6 +4561,11 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
4497
4561
|
true
|
|
4498
4562
|
);
|
|
4499
4563
|
}
|
|
4564
|
+
const resolveInitialScrollOffset = React3.useCallback((initialScroll) => {
|
|
4565
|
+
const baseOffset = initialScroll.index !== void 0 ? calculateOffsetForIndex(ctx, initialScroll.index) : 0;
|
|
4566
|
+
const resolvedOffset = calculateOffsetWithOffsetPosition(ctx, baseOffset, initialScroll);
|
|
4567
|
+
return clampScrollOffset(ctx, resolvedOffset, initialScroll);
|
|
4568
|
+
}, []);
|
|
4500
4569
|
const initialContentOffset = React3.useMemo(() => {
|
|
4501
4570
|
let value;
|
|
4502
4571
|
const { initialScroll, initialAnchor } = refState.current;
|
|
@@ -4504,9 +4573,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
4504
4573
|
if (initialScroll.contentOffset !== void 0) {
|
|
4505
4574
|
value = initialScroll.contentOffset;
|
|
4506
4575
|
} else {
|
|
4507
|
-
const
|
|
4508
|
-
const resolvedOffset = calculateOffsetWithOffsetPosition(ctx, baseOffset, initialScroll);
|
|
4509
|
-
const clampedOffset = clampScrollOffset(ctx, resolvedOffset, initialScroll);
|
|
4576
|
+
const clampedOffset = resolveInitialScrollOffset(initialScroll);
|
|
4510
4577
|
const updatedInitialScroll = { ...initialScroll, contentOffset: clampedOffset };
|
|
4511
4578
|
refState.current.initialScroll = updatedInitialScroll;
|
|
4512
4579
|
state.initialScroll = updatedInitialScroll;
|
|
@@ -4520,7 +4587,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
4520
4587
|
setInitialRenderState(ctx, { didInitialScroll: true });
|
|
4521
4588
|
}
|
|
4522
4589
|
return value;
|
|
4523
|
-
}, [
|
|
4590
|
+
}, []);
|
|
4524
4591
|
if (isFirstLocal || didDataChangeLocal || numColumnsProp !== peek$(ctx, "numColumns")) {
|
|
4525
4592
|
refState.current.lastBatchingAction = Date.now();
|
|
4526
4593
|
if (!keyExtractorProp && !isFirstLocal && didDataChangeLocal) {
|
|
@@ -4534,30 +4601,45 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
4534
4601
|
set$(ctx, "totalSize", 0);
|
|
4535
4602
|
}
|
|
4536
4603
|
}
|
|
4537
|
-
const onLayoutHeader = React3.useCallback((rect, fromLayoutEffect) => {
|
|
4538
|
-
const { initialScroll } = refState.current;
|
|
4539
|
-
const size = rect[horizontal ? "width" : "height"];
|
|
4540
|
-
set$(ctx, "headerSize", size);
|
|
4541
|
-
if ((initialScroll == null ? void 0 : initialScroll.index) !== void 0) {
|
|
4542
|
-
{
|
|
4543
|
-
if (fromLayoutEffect) {
|
|
4544
|
-
setRenderNum((v) => v + 1);
|
|
4545
|
-
}
|
|
4546
|
-
}
|
|
4547
|
-
}
|
|
4548
|
-
}, []);
|
|
4549
4604
|
const doInitialScroll = React3.useCallback(() => {
|
|
4550
4605
|
const { initialScroll, didFinishInitialScroll, queuedInitialLayout, scrollingTo } = state;
|
|
4551
4606
|
if (initialScroll && !queuedInitialLayout && !didFinishInitialScroll && !scrollingTo) {
|
|
4607
|
+
const offset = resolveInitialScrollOffset(initialScroll);
|
|
4608
|
+
const updatedInitialScroll = { ...initialScroll, contentOffset: offset };
|
|
4609
|
+
refState.current.initialScroll = updatedInitialScroll;
|
|
4610
|
+
state.initialScroll = updatedInitialScroll;
|
|
4552
4611
|
scrollTo(ctx, {
|
|
4553
4612
|
animated: false,
|
|
4554
|
-
index: initialScroll
|
|
4613
|
+
index: initialScroll.index,
|
|
4555
4614
|
isInitialScroll: true,
|
|
4556
|
-
offset
|
|
4615
|
+
offset,
|
|
4557
4616
|
precomputedWithViewOffset: true
|
|
4558
4617
|
});
|
|
4559
4618
|
}
|
|
4560
|
-
}, [
|
|
4619
|
+
}, []);
|
|
4620
|
+
const onLayoutFooter = React3.useCallback(
|
|
4621
|
+
(layout) => {
|
|
4622
|
+
if (!initialScrollAtEnd) {
|
|
4623
|
+
return;
|
|
4624
|
+
}
|
|
4625
|
+
const { initialScroll } = state;
|
|
4626
|
+
if (!initialScroll) {
|
|
4627
|
+
return;
|
|
4628
|
+
}
|
|
4629
|
+
const lastIndex = Math.max(0, dataProp.length - 1);
|
|
4630
|
+
if (initialScroll.index !== lastIndex || initialScroll.viewPosition !== 1) {
|
|
4631
|
+
return;
|
|
4632
|
+
}
|
|
4633
|
+
const footerSize = layout[horizontal ? "width" : "height"];
|
|
4634
|
+
const viewOffset = -stylePaddingBottomState - footerSize;
|
|
4635
|
+
if (initialScroll.viewOffset !== viewOffset) {
|
|
4636
|
+
const updatedInitialScroll = { ...initialScroll, viewOffset };
|
|
4637
|
+
refState.current.initialScroll = updatedInitialScroll;
|
|
4638
|
+
state.initialScroll = updatedInitialScroll;
|
|
4639
|
+
}
|
|
4640
|
+
},
|
|
4641
|
+
[dataProp.length, horizontal, initialScrollAtEnd, stylePaddingBottomState]
|
|
4642
|
+
);
|
|
4561
4643
|
const onLayoutChange = React3.useCallback((layout) => {
|
|
4562
4644
|
doInitialScroll();
|
|
4563
4645
|
handleLayout(ctx, layout, setCanRender);
|
|
@@ -4652,6 +4734,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
4652
4734
|
[]
|
|
4653
4735
|
);
|
|
4654
4736
|
const onScrollHandler = useStickyScrollHandler(stickyHeaderIndices, horizontal, ctx, fns.onScroll);
|
|
4737
|
+
const refreshControlElement = refreshControl;
|
|
4655
4738
|
return /* @__PURE__ */ React3__namespace.createElement(React3__namespace.Fragment, null, /* @__PURE__ */ React3__namespace.createElement(
|
|
4656
4739
|
ListComponent,
|
|
4657
4740
|
{
|
|
@@ -4666,13 +4749,13 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
4666
4749
|
ListEmptyComponent: dataProp.length === 0 ? ListEmptyComponent : void 0,
|
|
4667
4750
|
ListHeaderComponent,
|
|
4668
4751
|
onLayout,
|
|
4669
|
-
|
|
4752
|
+
onLayoutFooter,
|
|
4670
4753
|
onMomentumScrollEnd: fns.onMomentumScrollEnd,
|
|
4671
4754
|
onScroll: onScrollHandler,
|
|
4672
4755
|
recycleItems,
|
|
4673
|
-
refreshControl:
|
|
4674
|
-
progressViewOffset: (
|
|
4675
|
-
}) :
|
|
4756
|
+
refreshControl: refreshControlElement ? stylePaddingTopState > 0 ? React3__namespace.cloneElement(refreshControlElement, {
|
|
4757
|
+
progressViewOffset: ((_d = refreshControlElement.props.progressViewOffset) != null ? _d : 0) + stylePaddingTopState
|
|
4758
|
+
}) : refreshControlElement : onRefresh && /* @__PURE__ */ React3__namespace.createElement(
|
|
4676
4759
|
RefreshControl,
|
|
4677
4760
|
{
|
|
4678
4761
|
onRefresh,
|
|
@@ -4682,7 +4765,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
4682
4765
|
),
|
|
4683
4766
|
refScrollView: combinedRef,
|
|
4684
4767
|
renderScrollComponent,
|
|
4685
|
-
scrollAdjustHandler: (
|
|
4768
|
+
scrollAdjustHandler: (_e = refState.current) == null ? void 0 : _e.scrollAdjustHandler,
|
|
4686
4769
|
scrollEventThrottle: 0,
|
|
4687
4770
|
snapToIndices,
|
|
4688
4771
|
stickyHeaderIndices,
|