@legendapp/list 3.0.0-beta.13 → 3.0.0-beta.14
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 +1 -1
- package/index.d.mts +2 -2
- package/index.d.ts +2 -2
- package/index.js +10 -10
- package/index.mjs +10 -10
- package/index.native.d.mts +2 -2
- package/index.native.d.ts +2 -2
- package/index.native.js +11 -11
- package/index.native.mjs +11 -11
- package/package.json +1 -1
- package/section-list.d.mts +1 -1
- package/section-list.d.ts +1 -1
- package/section-list.js +10 -10
- package/section-list.mjs +10 -10
- package/section-list.native.d.mts +1 -1
- package/section-list.native.d.ts +1 -1
- package/section-list.native.js +11 -11
- package/section-list.native.mjs +11 -11
- package/{types-BSoW8ni4.d.mts → types-CdqSrGnu.d.mts} +5 -5
- package/{types-BSoW8ni4.d.ts → types-CdqSrGnu.d.ts} +5 -5
package/README.md
CHANGED
|
@@ -27,7 +27,7 @@ Beyond standard `FlatList` capabilities:
|
|
|
27
27
|
* `true`: Reuses item components for optimal performance. Be cautious if your item components contain local state, as it might be reused unexpectedly.
|
|
28
28
|
* `false` (default): Creates new item components every time. Less performant but safer if items have complex internal state.
|
|
29
29
|
* `maintainScrollAtEnd`: (boolean) If `true` and the user is scrolled near the bottom (within `maintainScrollAtEndThreshold * screen height`), the list automatically scrolls to the end when items are added or heights change. Useful for chat interfaces.
|
|
30
|
-
* `maintainVisibleContentPosition`: Keeps visible content steady during size/layout changes while scrolling (default). Pass `true` or `{
|
|
30
|
+
* `maintainVisibleContentPosition`: Keeps visible content steady during size/layout changes while scrolling up or when items resize above the viewport (default). Pass `true` or `{ data: true }` to also anchor during data updates; pass `false` to disable; pass `{ size: false }` to opt out of scroll-time stabilization.
|
|
31
31
|
* `alignItemsAtEnd`: (boolean) Useful for chat UIs, content smaller than the View will be aligned to the bottom of the list.
|
|
32
32
|
|
|
33
33
|
---
|
package/index.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { Dispatch, SetStateAction } from 'react';
|
|
3
|
-
import { L as LegendListProps, a as LegendListRef, V as ViewabilityCallback, b as ViewabilityAmountCallback, c as LegendListRecyclingState } from './types-
|
|
4
|
-
export { C as ColumnWrapperStyle, w as GetRenderedItem, G as GetRenderedItemResult, v as InitialScrollAnchor, I as InternalState, d as LegendListPropsBase, h as LegendListRenderItemProps, i as LegendListState, f as MaintainScrollAtEndOptions, M as MaintainVisibleContentPositionConfig, e as MaintainVisibleContentPositionNormalized, O as OnViewableItemsChanged, r as ScrollIndexWithOffset, u as ScrollIndexWithOffsetAndContentOffset, s as ScrollIndexWithOffsetPosition, S as ScrollTarget, T as ThresholdSnapshot, o as TypedForwardRef, p as TypedMemo, k as ViewAmountToken, j as ViewToken, n as ViewabilityConfig, l as ViewabilityConfigCallbackPair, m as ViewabilityConfigCallbackPairs, g as ViewableRange, t as typedForwardRef, q as typedMemo } from './types-
|
|
3
|
+
import { L as LegendListProps, a as LegendListRef, V as ViewabilityCallback, b as ViewabilityAmountCallback, c as LegendListRecyclingState } from './types-CdqSrGnu.mjs';
|
|
4
|
+
export { C as ColumnWrapperStyle, w as GetRenderedItem, G as GetRenderedItemResult, v as InitialScrollAnchor, I as InternalState, d as LegendListPropsBase, h as LegendListRenderItemProps, i as LegendListState, f as MaintainScrollAtEndOptions, M as MaintainVisibleContentPositionConfig, e as MaintainVisibleContentPositionNormalized, O as OnViewableItemsChanged, r as ScrollIndexWithOffset, u as ScrollIndexWithOffsetAndContentOffset, s as ScrollIndexWithOffsetPosition, S as ScrollTarget, T as ThresholdSnapshot, o as TypedForwardRef, p as TypedMemo, k as ViewAmountToken, j as ViewToken, n as ViewabilityConfig, l as ViewabilityConfigCallbackPair, m as ViewabilityConfigCallbackPairs, g as ViewableRange, t as typedForwardRef, q as typedMemo } from './types-CdqSrGnu.mjs';
|
|
5
5
|
import 'react-native';
|
|
6
6
|
import 'react-native-reanimated';
|
|
7
7
|
|
package/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { Dispatch, SetStateAction } from 'react';
|
|
3
|
-
import { L as LegendListProps, a as LegendListRef, V as ViewabilityCallback, b as ViewabilityAmountCallback, c as LegendListRecyclingState } from './types-
|
|
4
|
-
export { C as ColumnWrapperStyle, w as GetRenderedItem, G as GetRenderedItemResult, v as InitialScrollAnchor, I as InternalState, d as LegendListPropsBase, h as LegendListRenderItemProps, i as LegendListState, f as MaintainScrollAtEndOptions, M as MaintainVisibleContentPositionConfig, e as MaintainVisibleContentPositionNormalized, O as OnViewableItemsChanged, r as ScrollIndexWithOffset, u as ScrollIndexWithOffsetAndContentOffset, s as ScrollIndexWithOffsetPosition, S as ScrollTarget, T as ThresholdSnapshot, o as TypedForwardRef, p as TypedMemo, k as ViewAmountToken, j as ViewToken, n as ViewabilityConfig, l as ViewabilityConfigCallbackPair, m as ViewabilityConfigCallbackPairs, g as ViewableRange, t as typedForwardRef, q as typedMemo } from './types-
|
|
3
|
+
import { L as LegendListProps, a as LegendListRef, V as ViewabilityCallback, b as ViewabilityAmountCallback, c as LegendListRecyclingState } from './types-CdqSrGnu.js';
|
|
4
|
+
export { C as ColumnWrapperStyle, w as GetRenderedItem, G as GetRenderedItemResult, v as InitialScrollAnchor, I as InternalState, d as LegendListPropsBase, h as LegendListRenderItemProps, i as LegendListState, f as MaintainScrollAtEndOptions, M as MaintainVisibleContentPositionConfig, e as MaintainVisibleContentPositionNormalized, O as OnViewableItemsChanged, r as ScrollIndexWithOffset, u as ScrollIndexWithOffsetAndContentOffset, s as ScrollIndexWithOffsetPosition, S as ScrollTarget, T as ThresholdSnapshot, o as TypedForwardRef, p as TypedMemo, k as ViewAmountToken, j as ViewToken, n as ViewabilityConfig, l as ViewabilityConfigCallbackPair, m as ViewabilityConfigCallbackPairs, g as ViewableRange, t as typedForwardRef, q as typedMemo } from './types-CdqSrGnu.js';
|
|
5
5
|
import 'react-native';
|
|
6
6
|
import 'react-native-reanimated';
|
|
7
7
|
|
package/index.js
CHANGED
|
@@ -1230,7 +1230,7 @@ var ListComponent = typedMemo(function ListComponent2({
|
|
|
1230
1230
|
],
|
|
1231
1231
|
contentOffset: initialContentOffset ? horizontal ? { x: initialContentOffset, y: 0 } : { x: 0, y: initialContentOffset } : void 0,
|
|
1232
1232
|
horizontal,
|
|
1233
|
-
maintainVisibleContentPosition: maintainVisibleContentPosition.
|
|
1233
|
+
maintainVisibleContentPosition: maintainVisibleContentPosition.size || maintainVisibleContentPosition.data ? { minIndexForVisible: 0 } : void 0,
|
|
1234
1234
|
onLayout,
|
|
1235
1235
|
onScroll: onScroll2,
|
|
1236
1236
|
ref: refScrollView,
|
|
@@ -1775,7 +1775,7 @@ function prepareMVCP(ctx, dataChanged) {
|
|
|
1775
1775
|
const state = ctx.state;
|
|
1776
1776
|
const { idsInView, positions, props } = state;
|
|
1777
1777
|
const {
|
|
1778
|
-
maintainVisibleContentPosition: {
|
|
1778
|
+
maintainVisibleContentPosition: { data: mvcpData, size: mvcpScroll }
|
|
1779
1779
|
} = props;
|
|
1780
1780
|
const scrollingTo = state.scrollingTo;
|
|
1781
1781
|
let prevPosition;
|
|
@@ -1783,7 +1783,7 @@ function prepareMVCP(ctx, dataChanged) {
|
|
|
1783
1783
|
const idsInViewWithPositions = [];
|
|
1784
1784
|
const scrollTarget = scrollingTo == null ? void 0 : scrollingTo.index;
|
|
1785
1785
|
const scrollingToViewPosition = scrollingTo == null ? void 0 : scrollingTo.viewPosition;
|
|
1786
|
-
const shouldMVCP = dataChanged ?
|
|
1786
|
+
const shouldMVCP = dataChanged ? mvcpData : mvcpScroll;
|
|
1787
1787
|
const indexByKey = state.indexByKey;
|
|
1788
1788
|
if (shouldMVCP) {
|
|
1789
1789
|
if (scrollTarget !== void 0) {
|
|
@@ -1806,7 +1806,7 @@ function prepareMVCP(ctx, dataChanged) {
|
|
|
1806
1806
|
}
|
|
1807
1807
|
return () => {
|
|
1808
1808
|
let positionDiff = 0;
|
|
1809
|
-
if (dataChanged && targetId === void 0 &&
|
|
1809
|
+
if (dataChanged && targetId === void 0 && mvcpData) {
|
|
1810
1810
|
for (let i = 0; i < idsInViewWithPositions.length; i++) {
|
|
1811
1811
|
const { id, position } = idsInViewWithPositions[i];
|
|
1812
1812
|
const newPosition = positions.get(id);
|
|
@@ -3515,18 +3515,18 @@ function getRenderedItem(ctx, key) {
|
|
|
3515
3515
|
function normalizeMaintainVisibleContentPosition(value) {
|
|
3516
3516
|
var _a3, _b;
|
|
3517
3517
|
if (value === true) {
|
|
3518
|
-
return {
|
|
3518
|
+
return { data: true, size: true };
|
|
3519
3519
|
}
|
|
3520
3520
|
if (value && typeof value === "object") {
|
|
3521
3521
|
return {
|
|
3522
|
-
|
|
3523
|
-
|
|
3522
|
+
data: (_a3 = value.data) != null ? _a3 : false,
|
|
3523
|
+
size: (_b = value.size) != null ? _b : true
|
|
3524
3524
|
};
|
|
3525
3525
|
}
|
|
3526
3526
|
if (value === false) {
|
|
3527
|
-
return {
|
|
3527
|
+
return { data: false, size: false };
|
|
3528
3528
|
}
|
|
3529
|
-
return {
|
|
3529
|
+
return { data: false, size: true };
|
|
3530
3530
|
}
|
|
3531
3531
|
function useThrottleDebounce(mode) {
|
|
3532
3532
|
const timeoutRef = React3.useRef(null);
|
|
@@ -3813,7 +3813,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
3813
3813
|
setPaddingTop(ctx, { stylePaddingTop: stylePaddingTopState });
|
|
3814
3814
|
refState.current.props.stylePaddingBottom = stylePaddingBottomState;
|
|
3815
3815
|
let paddingDiff = stylePaddingTopState - prevPaddingTop;
|
|
3816
|
-
if (maintainVisibleContentPositionConfig.
|
|
3816
|
+
if (maintainVisibleContentPositionConfig.size && paddingDiff && prevPaddingTop !== void 0 && Platform.OS === "ios") {
|
|
3817
3817
|
if (state.scroll < 0) {
|
|
3818
3818
|
paddingDiff += state.scroll;
|
|
3819
3819
|
}
|
package/index.mjs
CHANGED
|
@@ -1209,7 +1209,7 @@ var ListComponent = typedMemo(function ListComponent2({
|
|
|
1209
1209
|
],
|
|
1210
1210
|
contentOffset: initialContentOffset ? horizontal ? { x: initialContentOffset, y: 0 } : { x: 0, y: initialContentOffset } : void 0,
|
|
1211
1211
|
horizontal,
|
|
1212
|
-
maintainVisibleContentPosition: maintainVisibleContentPosition.
|
|
1212
|
+
maintainVisibleContentPosition: maintainVisibleContentPosition.size || maintainVisibleContentPosition.data ? { minIndexForVisible: 0 } : void 0,
|
|
1213
1213
|
onLayout,
|
|
1214
1214
|
onScroll: onScroll2,
|
|
1215
1215
|
ref: refScrollView,
|
|
@@ -1754,7 +1754,7 @@ function prepareMVCP(ctx, dataChanged) {
|
|
|
1754
1754
|
const state = ctx.state;
|
|
1755
1755
|
const { idsInView, positions, props } = state;
|
|
1756
1756
|
const {
|
|
1757
|
-
maintainVisibleContentPosition: {
|
|
1757
|
+
maintainVisibleContentPosition: { data: mvcpData, size: mvcpScroll }
|
|
1758
1758
|
} = props;
|
|
1759
1759
|
const scrollingTo = state.scrollingTo;
|
|
1760
1760
|
let prevPosition;
|
|
@@ -1762,7 +1762,7 @@ function prepareMVCP(ctx, dataChanged) {
|
|
|
1762
1762
|
const idsInViewWithPositions = [];
|
|
1763
1763
|
const scrollTarget = scrollingTo == null ? void 0 : scrollingTo.index;
|
|
1764
1764
|
const scrollingToViewPosition = scrollingTo == null ? void 0 : scrollingTo.viewPosition;
|
|
1765
|
-
const shouldMVCP = dataChanged ?
|
|
1765
|
+
const shouldMVCP = dataChanged ? mvcpData : mvcpScroll;
|
|
1766
1766
|
const indexByKey = state.indexByKey;
|
|
1767
1767
|
if (shouldMVCP) {
|
|
1768
1768
|
if (scrollTarget !== void 0) {
|
|
@@ -1785,7 +1785,7 @@ function prepareMVCP(ctx, dataChanged) {
|
|
|
1785
1785
|
}
|
|
1786
1786
|
return () => {
|
|
1787
1787
|
let positionDiff = 0;
|
|
1788
|
-
if (dataChanged && targetId === void 0 &&
|
|
1788
|
+
if (dataChanged && targetId === void 0 && mvcpData) {
|
|
1789
1789
|
for (let i = 0; i < idsInViewWithPositions.length; i++) {
|
|
1790
1790
|
const { id, position } = idsInViewWithPositions[i];
|
|
1791
1791
|
const newPosition = positions.get(id);
|
|
@@ -3494,18 +3494,18 @@ function getRenderedItem(ctx, key) {
|
|
|
3494
3494
|
function normalizeMaintainVisibleContentPosition(value) {
|
|
3495
3495
|
var _a3, _b;
|
|
3496
3496
|
if (value === true) {
|
|
3497
|
-
return {
|
|
3497
|
+
return { data: true, size: true };
|
|
3498
3498
|
}
|
|
3499
3499
|
if (value && typeof value === "object") {
|
|
3500
3500
|
return {
|
|
3501
|
-
|
|
3502
|
-
|
|
3501
|
+
data: (_a3 = value.data) != null ? _a3 : false,
|
|
3502
|
+
size: (_b = value.size) != null ? _b : true
|
|
3503
3503
|
};
|
|
3504
3504
|
}
|
|
3505
3505
|
if (value === false) {
|
|
3506
|
-
return {
|
|
3506
|
+
return { data: false, size: false };
|
|
3507
3507
|
}
|
|
3508
|
-
return {
|
|
3508
|
+
return { data: false, size: true };
|
|
3509
3509
|
}
|
|
3510
3510
|
function useThrottleDebounce(mode) {
|
|
3511
3511
|
const timeoutRef = useRef(null);
|
|
@@ -3792,7 +3792,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
3792
3792
|
setPaddingTop(ctx, { stylePaddingTop: stylePaddingTopState });
|
|
3793
3793
|
refState.current.props.stylePaddingBottom = stylePaddingBottomState;
|
|
3794
3794
|
let paddingDiff = stylePaddingTopState - prevPaddingTop;
|
|
3795
|
-
if (maintainVisibleContentPositionConfig.
|
|
3795
|
+
if (maintainVisibleContentPositionConfig.size && paddingDiff && prevPaddingTop !== void 0 && Platform.OS === "ios") {
|
|
3796
3796
|
if (state.scroll < 0) {
|
|
3797
3797
|
paddingDiff += state.scroll;
|
|
3798
3798
|
}
|
package/index.native.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { Dispatch, SetStateAction } from 'react';
|
|
3
|
-
import { L as LegendListProps, a as LegendListRef, V as ViewabilityCallback, b as ViewabilityAmountCallback, c as LegendListRecyclingState } from './types-
|
|
4
|
-
export { C as ColumnWrapperStyle, w as GetRenderedItem, G as GetRenderedItemResult, v as InitialScrollAnchor, I as InternalState, d as LegendListPropsBase, h as LegendListRenderItemProps, i as LegendListState, f as MaintainScrollAtEndOptions, M as MaintainVisibleContentPositionConfig, e as MaintainVisibleContentPositionNormalized, O as OnViewableItemsChanged, r as ScrollIndexWithOffset, u as ScrollIndexWithOffsetAndContentOffset, s as ScrollIndexWithOffsetPosition, S as ScrollTarget, T as ThresholdSnapshot, o as TypedForwardRef, p as TypedMemo, k as ViewAmountToken, j as ViewToken, n as ViewabilityConfig, l as ViewabilityConfigCallbackPair, m as ViewabilityConfigCallbackPairs, g as ViewableRange, t as typedForwardRef, q as typedMemo } from './types-
|
|
3
|
+
import { L as LegendListProps, a as LegendListRef, V as ViewabilityCallback, b as ViewabilityAmountCallback, c as LegendListRecyclingState } from './types-CdqSrGnu.mjs';
|
|
4
|
+
export { C as ColumnWrapperStyle, w as GetRenderedItem, G as GetRenderedItemResult, v as InitialScrollAnchor, I as InternalState, d as LegendListPropsBase, h as LegendListRenderItemProps, i as LegendListState, f as MaintainScrollAtEndOptions, M as MaintainVisibleContentPositionConfig, e as MaintainVisibleContentPositionNormalized, O as OnViewableItemsChanged, r as ScrollIndexWithOffset, u as ScrollIndexWithOffsetAndContentOffset, s as ScrollIndexWithOffsetPosition, S as ScrollTarget, T as ThresholdSnapshot, o as TypedForwardRef, p as TypedMemo, k as ViewAmountToken, j as ViewToken, n as ViewabilityConfig, l as ViewabilityConfigCallbackPair, m as ViewabilityConfigCallbackPairs, g as ViewableRange, t as typedForwardRef, q as typedMemo } from './types-CdqSrGnu.mjs';
|
|
5
5
|
import 'react-native';
|
|
6
6
|
import 'react-native-reanimated';
|
|
7
7
|
|
package/index.native.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { Dispatch, SetStateAction } from 'react';
|
|
3
|
-
import { L as LegendListProps, a as LegendListRef, V as ViewabilityCallback, b as ViewabilityAmountCallback, c as LegendListRecyclingState } from './types-
|
|
4
|
-
export { C as ColumnWrapperStyle, w as GetRenderedItem, G as GetRenderedItemResult, v as InitialScrollAnchor, I as InternalState, d as LegendListPropsBase, h as LegendListRenderItemProps, i as LegendListState, f as MaintainScrollAtEndOptions, M as MaintainVisibleContentPositionConfig, e as MaintainVisibleContentPositionNormalized, O as OnViewableItemsChanged, r as ScrollIndexWithOffset, u as ScrollIndexWithOffsetAndContentOffset, s as ScrollIndexWithOffsetPosition, S as ScrollTarget, T as ThresholdSnapshot, o as TypedForwardRef, p as TypedMemo, k as ViewAmountToken, j as ViewToken, n as ViewabilityConfig, l as ViewabilityConfigCallbackPair, m as ViewabilityConfigCallbackPairs, g as ViewableRange, t as typedForwardRef, q as typedMemo } from './types-
|
|
3
|
+
import { L as LegendListProps, a as LegendListRef, V as ViewabilityCallback, b as ViewabilityAmountCallback, c as LegendListRecyclingState } from './types-CdqSrGnu.js';
|
|
4
|
+
export { C as ColumnWrapperStyle, w as GetRenderedItem, G as GetRenderedItemResult, v as InitialScrollAnchor, I as InternalState, d as LegendListPropsBase, h as LegendListRenderItemProps, i as LegendListState, f as MaintainScrollAtEndOptions, M as MaintainVisibleContentPositionConfig, e as MaintainVisibleContentPositionNormalized, O as OnViewableItemsChanged, r as ScrollIndexWithOffset, u as ScrollIndexWithOffsetAndContentOffset, s as ScrollIndexWithOffsetPosition, S as ScrollTarget, T as ThresholdSnapshot, o as TypedForwardRef, p as TypedMemo, k as ViewAmountToken, j as ViewToken, n as ViewabilityConfig, l as ViewabilityConfigCallbackPair, m as ViewabilityConfigCallbackPairs, g as ViewableRange, t as typedForwardRef, q as typedMemo } from './types-CdqSrGnu.js';
|
|
5
5
|
import 'react-native';
|
|
6
6
|
import 'react-native-reanimated';
|
|
7
7
|
|
package/index.native.js
CHANGED
|
@@ -938,7 +938,7 @@ var ListComponent = typedMemo(function ListComponent2({
|
|
|
938
938
|
],
|
|
939
939
|
contentOffset: initialContentOffset ? horizontal ? { x: initialContentOffset, y: 0 } : { x: 0, y: initialContentOffset } : void 0,
|
|
940
940
|
horizontal,
|
|
941
|
-
maintainVisibleContentPosition: maintainVisibleContentPosition.
|
|
941
|
+
maintainVisibleContentPosition: maintainVisibleContentPosition.size || maintainVisibleContentPosition.data ? { minIndexForVisible: 0 } : void 0,
|
|
942
942
|
onLayout,
|
|
943
943
|
onScroll: onScroll2,
|
|
944
944
|
ref: refScrollView,
|
|
@@ -1565,7 +1565,7 @@ function prepareMVCP(ctx, dataChanged) {
|
|
|
1565
1565
|
const state = ctx.state;
|
|
1566
1566
|
const { idsInView, positions, props } = state;
|
|
1567
1567
|
const {
|
|
1568
|
-
maintainVisibleContentPosition: {
|
|
1568
|
+
maintainVisibleContentPosition: { data: mvcpData, size: mvcpScroll }
|
|
1569
1569
|
} = props;
|
|
1570
1570
|
const scrollingTo = state.scrollingTo;
|
|
1571
1571
|
let prevPosition;
|
|
@@ -1573,7 +1573,7 @@ function prepareMVCP(ctx, dataChanged) {
|
|
|
1573
1573
|
const idsInViewWithPositions = [];
|
|
1574
1574
|
const scrollTarget = scrollingTo == null ? void 0 : scrollingTo.index;
|
|
1575
1575
|
const scrollingToViewPosition = scrollingTo == null ? void 0 : scrollingTo.viewPosition;
|
|
1576
|
-
const shouldMVCP = dataChanged ?
|
|
1576
|
+
const shouldMVCP = dataChanged ? mvcpData : mvcpScroll;
|
|
1577
1577
|
const indexByKey = state.indexByKey;
|
|
1578
1578
|
if (shouldMVCP) {
|
|
1579
1579
|
if (scrollTarget !== void 0) {
|
|
@@ -1599,7 +1599,7 @@ function prepareMVCP(ctx, dataChanged) {
|
|
|
1599
1599
|
}
|
|
1600
1600
|
return () => {
|
|
1601
1601
|
let positionDiff = 0;
|
|
1602
|
-
if (dataChanged && targetId === void 0 &&
|
|
1602
|
+
if (dataChanged && targetId === void 0 && mvcpData) {
|
|
1603
1603
|
for (let i = 0; i < idsInViewWithPositions.length; i++) {
|
|
1604
1604
|
const { id, position } = idsInViewWithPositions[i];
|
|
1605
1605
|
const newPosition = positions.get(id);
|
|
@@ -1636,7 +1636,7 @@ function prepareMVCP(ctx, dataChanged) {
|
|
|
1636
1636
|
}
|
|
1637
1637
|
}
|
|
1638
1638
|
if (Math.abs(positionDiff) > 0.1) {
|
|
1639
|
-
requestAdjust(ctx, positionDiff, dataChanged &&
|
|
1639
|
+
requestAdjust(ctx, positionDiff, dataChanged && mvcpData);
|
|
1640
1640
|
}
|
|
1641
1641
|
};
|
|
1642
1642
|
}
|
|
@@ -3301,18 +3301,18 @@ function getRenderedItem(ctx, key) {
|
|
|
3301
3301
|
function normalizeMaintainVisibleContentPosition(value) {
|
|
3302
3302
|
var _a3, _b;
|
|
3303
3303
|
if (value === true) {
|
|
3304
|
-
return {
|
|
3304
|
+
return { data: true, size: true };
|
|
3305
3305
|
}
|
|
3306
3306
|
if (value && typeof value === "object") {
|
|
3307
3307
|
return {
|
|
3308
|
-
|
|
3309
|
-
|
|
3308
|
+
data: (_a3 = value.data) != null ? _a3 : false,
|
|
3309
|
+
size: (_b = value.size) != null ? _b : true
|
|
3310
3310
|
};
|
|
3311
3311
|
}
|
|
3312
3312
|
if (value === false) {
|
|
3313
|
-
return {
|
|
3313
|
+
return { data: false, size: false };
|
|
3314
3314
|
}
|
|
3315
|
-
return {
|
|
3315
|
+
return { data: false, size: true };
|
|
3316
3316
|
}
|
|
3317
3317
|
function useThrottleDebounce(mode) {
|
|
3318
3318
|
const timeoutRef = React2.useRef(null);
|
|
@@ -3599,7 +3599,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
3599
3599
|
setPaddingTop(ctx, { stylePaddingTop: stylePaddingTopState });
|
|
3600
3600
|
refState.current.props.stylePaddingBottom = stylePaddingBottomState;
|
|
3601
3601
|
let paddingDiff = stylePaddingTopState - prevPaddingTop;
|
|
3602
|
-
if (maintainVisibleContentPositionConfig.
|
|
3602
|
+
if (maintainVisibleContentPositionConfig.size && paddingDiff && prevPaddingTop !== void 0 && Platform2.OS === "ios") {
|
|
3603
3603
|
if (state.scroll < 0) {
|
|
3604
3604
|
paddingDiff += state.scroll;
|
|
3605
3605
|
}
|
package/index.native.mjs
CHANGED
|
@@ -917,7 +917,7 @@ var ListComponent = typedMemo(function ListComponent2({
|
|
|
917
917
|
],
|
|
918
918
|
contentOffset: initialContentOffset ? horizontal ? { x: initialContentOffset, y: 0 } : { x: 0, y: initialContentOffset } : void 0,
|
|
919
919
|
horizontal,
|
|
920
|
-
maintainVisibleContentPosition: maintainVisibleContentPosition.
|
|
920
|
+
maintainVisibleContentPosition: maintainVisibleContentPosition.size || maintainVisibleContentPosition.data ? { minIndexForVisible: 0 } : void 0,
|
|
921
921
|
onLayout,
|
|
922
922
|
onScroll: onScroll2,
|
|
923
923
|
ref: refScrollView,
|
|
@@ -1544,7 +1544,7 @@ function prepareMVCP(ctx, dataChanged) {
|
|
|
1544
1544
|
const state = ctx.state;
|
|
1545
1545
|
const { idsInView, positions, props } = state;
|
|
1546
1546
|
const {
|
|
1547
|
-
maintainVisibleContentPosition: {
|
|
1547
|
+
maintainVisibleContentPosition: { data: mvcpData, size: mvcpScroll }
|
|
1548
1548
|
} = props;
|
|
1549
1549
|
const scrollingTo = state.scrollingTo;
|
|
1550
1550
|
let prevPosition;
|
|
@@ -1552,7 +1552,7 @@ function prepareMVCP(ctx, dataChanged) {
|
|
|
1552
1552
|
const idsInViewWithPositions = [];
|
|
1553
1553
|
const scrollTarget = scrollingTo == null ? void 0 : scrollingTo.index;
|
|
1554
1554
|
const scrollingToViewPosition = scrollingTo == null ? void 0 : scrollingTo.viewPosition;
|
|
1555
|
-
const shouldMVCP = dataChanged ?
|
|
1555
|
+
const shouldMVCP = dataChanged ? mvcpData : mvcpScroll;
|
|
1556
1556
|
const indexByKey = state.indexByKey;
|
|
1557
1557
|
if (shouldMVCP) {
|
|
1558
1558
|
if (scrollTarget !== void 0) {
|
|
@@ -1578,7 +1578,7 @@ function prepareMVCP(ctx, dataChanged) {
|
|
|
1578
1578
|
}
|
|
1579
1579
|
return () => {
|
|
1580
1580
|
let positionDiff = 0;
|
|
1581
|
-
if (dataChanged && targetId === void 0 &&
|
|
1581
|
+
if (dataChanged && targetId === void 0 && mvcpData) {
|
|
1582
1582
|
for (let i = 0; i < idsInViewWithPositions.length; i++) {
|
|
1583
1583
|
const { id, position } = idsInViewWithPositions[i];
|
|
1584
1584
|
const newPosition = positions.get(id);
|
|
@@ -1615,7 +1615,7 @@ function prepareMVCP(ctx, dataChanged) {
|
|
|
1615
1615
|
}
|
|
1616
1616
|
}
|
|
1617
1617
|
if (Math.abs(positionDiff) > 0.1) {
|
|
1618
|
-
requestAdjust(ctx, positionDiff, dataChanged &&
|
|
1618
|
+
requestAdjust(ctx, positionDiff, dataChanged && mvcpData);
|
|
1619
1619
|
}
|
|
1620
1620
|
};
|
|
1621
1621
|
}
|
|
@@ -3280,18 +3280,18 @@ function getRenderedItem(ctx, key) {
|
|
|
3280
3280
|
function normalizeMaintainVisibleContentPosition(value) {
|
|
3281
3281
|
var _a3, _b;
|
|
3282
3282
|
if (value === true) {
|
|
3283
|
-
return {
|
|
3283
|
+
return { data: true, size: true };
|
|
3284
3284
|
}
|
|
3285
3285
|
if (value && typeof value === "object") {
|
|
3286
3286
|
return {
|
|
3287
|
-
|
|
3288
|
-
|
|
3287
|
+
data: (_a3 = value.data) != null ? _a3 : false,
|
|
3288
|
+
size: (_b = value.size) != null ? _b : true
|
|
3289
3289
|
};
|
|
3290
3290
|
}
|
|
3291
3291
|
if (value === false) {
|
|
3292
|
-
return {
|
|
3292
|
+
return { data: false, size: false };
|
|
3293
3293
|
}
|
|
3294
|
-
return {
|
|
3294
|
+
return { data: false, size: true };
|
|
3295
3295
|
}
|
|
3296
3296
|
function useThrottleDebounce(mode) {
|
|
3297
3297
|
const timeoutRef = useRef(null);
|
|
@@ -3578,7 +3578,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
3578
3578
|
setPaddingTop(ctx, { stylePaddingTop: stylePaddingTopState });
|
|
3579
3579
|
refState.current.props.stylePaddingBottom = stylePaddingBottomState;
|
|
3580
3580
|
let paddingDiff = stylePaddingTopState - prevPaddingTop;
|
|
3581
|
-
if (maintainVisibleContentPositionConfig.
|
|
3581
|
+
if (maintainVisibleContentPositionConfig.size && paddingDiff && prevPaddingTop !== void 0 && Platform2.OS === "ios") {
|
|
3582
3582
|
if (state.scroll < 0) {
|
|
3583
3583
|
paddingDiff += state.scroll;
|
|
3584
3584
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@legendapp/list",
|
|
3
|
-
"version": "3.0.0-beta.
|
|
3
|
+
"version": "3.0.0-beta.14",
|
|
4
4
|
"description": "Legend List is a drop-in replacement for FlatList with much better performance and supporting dynamically sized items.",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"private": false,
|
package/section-list.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as react_native from 'react-native';
|
|
2
2
|
import { SectionListData, SectionBase, SectionListRenderItemInfo, SectionListScrollParams } from 'react-native';
|
|
3
3
|
import * as React from 'react';
|
|
4
|
-
import { a as LegendListRef, L as LegendListProps } from './types-
|
|
4
|
+
import { a as LegendListRef, L as LegendListProps } from './types-CdqSrGnu.mjs';
|
|
5
5
|
import 'react-native-reanimated';
|
|
6
6
|
|
|
7
7
|
type SectionListSeparatorProps<ItemT, SectionT> = {
|
package/section-list.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as react_native from 'react-native';
|
|
2
2
|
import { SectionListData, SectionBase, SectionListRenderItemInfo, SectionListScrollParams } from 'react-native';
|
|
3
3
|
import * as React from 'react';
|
|
4
|
-
import { a as LegendListRef, L as LegendListProps } from './types-
|
|
4
|
+
import { a as LegendListRef, L as LegendListProps } from './types-CdqSrGnu.js';
|
|
5
5
|
import 'react-native-reanimated';
|
|
6
6
|
|
|
7
7
|
type SectionListSeparatorProps<ItemT, SectionT> = {
|
package/section-list.js
CHANGED
|
@@ -1097,7 +1097,7 @@ var ListComponent = typedMemo(function ListComponent2({
|
|
|
1097
1097
|
],
|
|
1098
1098
|
contentOffset: initialContentOffset ? horizontal ? { x: initialContentOffset, y: 0 } : { x: 0, y: initialContentOffset } : void 0,
|
|
1099
1099
|
horizontal,
|
|
1100
|
-
maintainVisibleContentPosition: maintainVisibleContentPosition.
|
|
1100
|
+
maintainVisibleContentPosition: maintainVisibleContentPosition.size || maintainVisibleContentPosition.data ? { minIndexForVisible: 0 } : void 0,
|
|
1101
1101
|
onLayout,
|
|
1102
1102
|
onScroll: onScroll2,
|
|
1103
1103
|
ref: refScrollView,
|
|
@@ -1642,7 +1642,7 @@ function prepareMVCP(ctx, dataChanged) {
|
|
|
1642
1642
|
const state = ctx.state;
|
|
1643
1643
|
const { idsInView, positions, props } = state;
|
|
1644
1644
|
const {
|
|
1645
|
-
maintainVisibleContentPosition: {
|
|
1645
|
+
maintainVisibleContentPosition: { data: mvcpData, size: mvcpScroll }
|
|
1646
1646
|
} = props;
|
|
1647
1647
|
const scrollingTo = state.scrollingTo;
|
|
1648
1648
|
let prevPosition;
|
|
@@ -1650,7 +1650,7 @@ function prepareMVCP(ctx, dataChanged) {
|
|
|
1650
1650
|
const idsInViewWithPositions = [];
|
|
1651
1651
|
const scrollTarget = scrollingTo == null ? void 0 : scrollingTo.index;
|
|
1652
1652
|
const scrollingToViewPosition = scrollingTo == null ? void 0 : scrollingTo.viewPosition;
|
|
1653
|
-
const shouldMVCP = dataChanged ?
|
|
1653
|
+
const shouldMVCP = dataChanged ? mvcpData : mvcpScroll;
|
|
1654
1654
|
const indexByKey = state.indexByKey;
|
|
1655
1655
|
if (shouldMVCP) {
|
|
1656
1656
|
if (scrollTarget !== void 0) {
|
|
@@ -1673,7 +1673,7 @@ function prepareMVCP(ctx, dataChanged) {
|
|
|
1673
1673
|
}
|
|
1674
1674
|
return () => {
|
|
1675
1675
|
let positionDiff = 0;
|
|
1676
|
-
if (dataChanged && targetId === void 0 &&
|
|
1676
|
+
if (dataChanged && targetId === void 0 && mvcpData) {
|
|
1677
1677
|
for (let i = 0; i < idsInViewWithPositions.length; i++) {
|
|
1678
1678
|
const { id, position } = idsInViewWithPositions[i];
|
|
1679
1679
|
const newPosition = positions.get(id);
|
|
@@ -3382,18 +3382,18 @@ function getRenderedItem(ctx, key) {
|
|
|
3382
3382
|
function normalizeMaintainVisibleContentPosition(value) {
|
|
3383
3383
|
var _a3, _b;
|
|
3384
3384
|
if (value === true) {
|
|
3385
|
-
return {
|
|
3385
|
+
return { data: true, size: true };
|
|
3386
3386
|
}
|
|
3387
3387
|
if (value && typeof value === "object") {
|
|
3388
3388
|
return {
|
|
3389
|
-
|
|
3390
|
-
|
|
3389
|
+
data: (_a3 = value.data) != null ? _a3 : false,
|
|
3390
|
+
size: (_b = value.size) != null ? _b : true
|
|
3391
3391
|
};
|
|
3392
3392
|
}
|
|
3393
3393
|
if (value === false) {
|
|
3394
|
-
return {
|
|
3394
|
+
return { data: false, size: false };
|
|
3395
3395
|
}
|
|
3396
|
-
return {
|
|
3396
|
+
return { data: false, size: true };
|
|
3397
3397
|
}
|
|
3398
3398
|
function useThrottleDebounce(mode) {
|
|
3399
3399
|
const timeoutRef = React3.useRef(null);
|
|
@@ -3680,7 +3680,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
3680
3680
|
setPaddingTop(ctx, { stylePaddingTop: stylePaddingTopState });
|
|
3681
3681
|
refState.current.props.stylePaddingBottom = stylePaddingBottomState;
|
|
3682
3682
|
let paddingDiff = stylePaddingTopState - prevPaddingTop;
|
|
3683
|
-
if (maintainVisibleContentPositionConfig.
|
|
3683
|
+
if (maintainVisibleContentPositionConfig.size && paddingDiff && prevPaddingTop !== void 0 && Platform.OS === "ios") {
|
|
3684
3684
|
if (state.scroll < 0) {
|
|
3685
3685
|
paddingDiff += state.scroll;
|
|
3686
3686
|
}
|
package/section-list.mjs
CHANGED
|
@@ -1076,7 +1076,7 @@ var ListComponent = typedMemo(function ListComponent2({
|
|
|
1076
1076
|
],
|
|
1077
1077
|
contentOffset: initialContentOffset ? horizontal ? { x: initialContentOffset, y: 0 } : { x: 0, y: initialContentOffset } : void 0,
|
|
1078
1078
|
horizontal,
|
|
1079
|
-
maintainVisibleContentPosition: maintainVisibleContentPosition.
|
|
1079
|
+
maintainVisibleContentPosition: maintainVisibleContentPosition.size || maintainVisibleContentPosition.data ? { minIndexForVisible: 0 } : void 0,
|
|
1080
1080
|
onLayout,
|
|
1081
1081
|
onScroll: onScroll2,
|
|
1082
1082
|
ref: refScrollView,
|
|
@@ -1621,7 +1621,7 @@ function prepareMVCP(ctx, dataChanged) {
|
|
|
1621
1621
|
const state = ctx.state;
|
|
1622
1622
|
const { idsInView, positions, props } = state;
|
|
1623
1623
|
const {
|
|
1624
|
-
maintainVisibleContentPosition: {
|
|
1624
|
+
maintainVisibleContentPosition: { data: mvcpData, size: mvcpScroll }
|
|
1625
1625
|
} = props;
|
|
1626
1626
|
const scrollingTo = state.scrollingTo;
|
|
1627
1627
|
let prevPosition;
|
|
@@ -1629,7 +1629,7 @@ function prepareMVCP(ctx, dataChanged) {
|
|
|
1629
1629
|
const idsInViewWithPositions = [];
|
|
1630
1630
|
const scrollTarget = scrollingTo == null ? void 0 : scrollingTo.index;
|
|
1631
1631
|
const scrollingToViewPosition = scrollingTo == null ? void 0 : scrollingTo.viewPosition;
|
|
1632
|
-
const shouldMVCP = dataChanged ?
|
|
1632
|
+
const shouldMVCP = dataChanged ? mvcpData : mvcpScroll;
|
|
1633
1633
|
const indexByKey = state.indexByKey;
|
|
1634
1634
|
if (shouldMVCP) {
|
|
1635
1635
|
if (scrollTarget !== void 0) {
|
|
@@ -1652,7 +1652,7 @@ function prepareMVCP(ctx, dataChanged) {
|
|
|
1652
1652
|
}
|
|
1653
1653
|
return () => {
|
|
1654
1654
|
let positionDiff = 0;
|
|
1655
|
-
if (dataChanged && targetId === void 0 &&
|
|
1655
|
+
if (dataChanged && targetId === void 0 && mvcpData) {
|
|
1656
1656
|
for (let i = 0; i < idsInViewWithPositions.length; i++) {
|
|
1657
1657
|
const { id, position } = idsInViewWithPositions[i];
|
|
1658
1658
|
const newPosition = positions.get(id);
|
|
@@ -3361,18 +3361,18 @@ function getRenderedItem(ctx, key) {
|
|
|
3361
3361
|
function normalizeMaintainVisibleContentPosition(value) {
|
|
3362
3362
|
var _a3, _b;
|
|
3363
3363
|
if (value === true) {
|
|
3364
|
-
return {
|
|
3364
|
+
return { data: true, size: true };
|
|
3365
3365
|
}
|
|
3366
3366
|
if (value && typeof value === "object") {
|
|
3367
3367
|
return {
|
|
3368
|
-
|
|
3369
|
-
|
|
3368
|
+
data: (_a3 = value.data) != null ? _a3 : false,
|
|
3369
|
+
size: (_b = value.size) != null ? _b : true
|
|
3370
3370
|
};
|
|
3371
3371
|
}
|
|
3372
3372
|
if (value === false) {
|
|
3373
|
-
return {
|
|
3373
|
+
return { data: false, size: false };
|
|
3374
3374
|
}
|
|
3375
|
-
return {
|
|
3375
|
+
return { data: false, size: true };
|
|
3376
3376
|
}
|
|
3377
3377
|
function useThrottleDebounce(mode) {
|
|
3378
3378
|
const timeoutRef = useRef(null);
|
|
@@ -3659,7 +3659,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
3659
3659
|
setPaddingTop(ctx, { stylePaddingTop: stylePaddingTopState });
|
|
3660
3660
|
refState.current.props.stylePaddingBottom = stylePaddingBottomState;
|
|
3661
3661
|
let paddingDiff = stylePaddingTopState - prevPaddingTop;
|
|
3662
|
-
if (maintainVisibleContentPositionConfig.
|
|
3662
|
+
if (maintainVisibleContentPositionConfig.size && paddingDiff && prevPaddingTop !== void 0 && Platform.OS === "ios") {
|
|
3663
3663
|
if (state.scroll < 0) {
|
|
3664
3664
|
paddingDiff += state.scroll;
|
|
3665
3665
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as react_native from 'react-native';
|
|
2
2
|
import { SectionListData, SectionBase, SectionListRenderItemInfo, SectionListScrollParams } from 'react-native';
|
|
3
3
|
import * as React from 'react';
|
|
4
|
-
import { a as LegendListRef, L as LegendListProps } from './types-
|
|
4
|
+
import { a as LegendListRef, L as LegendListProps } from './types-CdqSrGnu.mjs';
|
|
5
5
|
import 'react-native-reanimated';
|
|
6
6
|
|
|
7
7
|
type SectionListSeparatorProps<ItemT, SectionT> = {
|
package/section-list.native.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as react_native from 'react-native';
|
|
2
2
|
import { SectionListData, SectionBase, SectionListRenderItemInfo, SectionListScrollParams } from 'react-native';
|
|
3
3
|
import * as React from 'react';
|
|
4
|
-
import { a as LegendListRef, L as LegendListProps } from './types-
|
|
4
|
+
import { a as LegendListRef, L as LegendListProps } from './types-CdqSrGnu.js';
|
|
5
5
|
import 'react-native-reanimated';
|
|
6
6
|
|
|
7
7
|
type SectionListSeparatorProps<ItemT, SectionT> = {
|
package/section-list.native.js
CHANGED
|
@@ -807,7 +807,7 @@ var ListComponent = typedMemo(function ListComponent2({
|
|
|
807
807
|
],
|
|
808
808
|
contentOffset: initialContentOffset ? horizontal ? { x: initialContentOffset, y: 0 } : { x: 0, y: initialContentOffset } : void 0,
|
|
809
809
|
horizontal,
|
|
810
|
-
maintainVisibleContentPosition: maintainVisibleContentPosition.
|
|
810
|
+
maintainVisibleContentPosition: maintainVisibleContentPosition.size || maintainVisibleContentPosition.data ? { minIndexForVisible: 0 } : void 0,
|
|
811
811
|
onLayout,
|
|
812
812
|
onScroll: onScroll2,
|
|
813
813
|
ref: refScrollView,
|
|
@@ -1434,7 +1434,7 @@ function prepareMVCP(ctx, dataChanged) {
|
|
|
1434
1434
|
const state = ctx.state;
|
|
1435
1435
|
const { idsInView, positions, props } = state;
|
|
1436
1436
|
const {
|
|
1437
|
-
maintainVisibleContentPosition: {
|
|
1437
|
+
maintainVisibleContentPosition: { data: mvcpData, size: mvcpScroll }
|
|
1438
1438
|
} = props;
|
|
1439
1439
|
const scrollingTo = state.scrollingTo;
|
|
1440
1440
|
let prevPosition;
|
|
@@ -1442,7 +1442,7 @@ function prepareMVCP(ctx, dataChanged) {
|
|
|
1442
1442
|
const idsInViewWithPositions = [];
|
|
1443
1443
|
const scrollTarget = scrollingTo == null ? void 0 : scrollingTo.index;
|
|
1444
1444
|
const scrollingToViewPosition = scrollingTo == null ? void 0 : scrollingTo.viewPosition;
|
|
1445
|
-
const shouldMVCP = dataChanged ?
|
|
1445
|
+
const shouldMVCP = dataChanged ? mvcpData : mvcpScroll;
|
|
1446
1446
|
const indexByKey = state.indexByKey;
|
|
1447
1447
|
if (shouldMVCP) {
|
|
1448
1448
|
if (scrollTarget !== void 0) {
|
|
@@ -1468,7 +1468,7 @@ function prepareMVCP(ctx, dataChanged) {
|
|
|
1468
1468
|
}
|
|
1469
1469
|
return () => {
|
|
1470
1470
|
let positionDiff = 0;
|
|
1471
|
-
if (dataChanged && targetId === void 0 &&
|
|
1471
|
+
if (dataChanged && targetId === void 0 && mvcpData) {
|
|
1472
1472
|
for (let i = 0; i < idsInViewWithPositions.length; i++) {
|
|
1473
1473
|
const { id, position } = idsInViewWithPositions[i];
|
|
1474
1474
|
const newPosition = positions.get(id);
|
|
@@ -1505,7 +1505,7 @@ function prepareMVCP(ctx, dataChanged) {
|
|
|
1505
1505
|
}
|
|
1506
1506
|
}
|
|
1507
1507
|
if (Math.abs(positionDiff) > 0.1) {
|
|
1508
|
-
requestAdjust(ctx, positionDiff, dataChanged &&
|
|
1508
|
+
requestAdjust(ctx, positionDiff, dataChanged && mvcpData);
|
|
1509
1509
|
}
|
|
1510
1510
|
};
|
|
1511
1511
|
}
|
|
@@ -3170,18 +3170,18 @@ function getRenderedItem(ctx, key) {
|
|
|
3170
3170
|
function normalizeMaintainVisibleContentPosition(value) {
|
|
3171
3171
|
var _a3, _b;
|
|
3172
3172
|
if (value === true) {
|
|
3173
|
-
return {
|
|
3173
|
+
return { data: true, size: true };
|
|
3174
3174
|
}
|
|
3175
3175
|
if (value && typeof value === "object") {
|
|
3176
3176
|
return {
|
|
3177
|
-
|
|
3178
|
-
|
|
3177
|
+
data: (_a3 = value.data) != null ? _a3 : false,
|
|
3178
|
+
size: (_b = value.size) != null ? _b : true
|
|
3179
3179
|
};
|
|
3180
3180
|
}
|
|
3181
3181
|
if (value === false) {
|
|
3182
|
-
return {
|
|
3182
|
+
return { data: false, size: false };
|
|
3183
3183
|
}
|
|
3184
|
-
return {
|
|
3184
|
+
return { data: false, size: true };
|
|
3185
3185
|
}
|
|
3186
3186
|
function useThrottleDebounce(mode) {
|
|
3187
3187
|
const timeoutRef = React2.useRef(null);
|
|
@@ -3468,7 +3468,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
3468
3468
|
setPaddingTop(ctx, { stylePaddingTop: stylePaddingTopState });
|
|
3469
3469
|
refState.current.props.stylePaddingBottom = stylePaddingBottomState;
|
|
3470
3470
|
let paddingDiff = stylePaddingTopState - prevPaddingTop;
|
|
3471
|
-
if (maintainVisibleContentPositionConfig.
|
|
3471
|
+
if (maintainVisibleContentPositionConfig.size && paddingDiff && prevPaddingTop !== void 0 && Platform2.OS === "ios") {
|
|
3472
3472
|
if (state.scroll < 0) {
|
|
3473
3473
|
paddingDiff += state.scroll;
|
|
3474
3474
|
}
|
package/section-list.native.mjs
CHANGED
|
@@ -786,7 +786,7 @@ var ListComponent = typedMemo(function ListComponent2({
|
|
|
786
786
|
],
|
|
787
787
|
contentOffset: initialContentOffset ? horizontal ? { x: initialContentOffset, y: 0 } : { x: 0, y: initialContentOffset } : void 0,
|
|
788
788
|
horizontal,
|
|
789
|
-
maintainVisibleContentPosition: maintainVisibleContentPosition.
|
|
789
|
+
maintainVisibleContentPosition: maintainVisibleContentPosition.size || maintainVisibleContentPosition.data ? { minIndexForVisible: 0 } : void 0,
|
|
790
790
|
onLayout,
|
|
791
791
|
onScroll: onScroll2,
|
|
792
792
|
ref: refScrollView,
|
|
@@ -1413,7 +1413,7 @@ function prepareMVCP(ctx, dataChanged) {
|
|
|
1413
1413
|
const state = ctx.state;
|
|
1414
1414
|
const { idsInView, positions, props } = state;
|
|
1415
1415
|
const {
|
|
1416
|
-
maintainVisibleContentPosition: {
|
|
1416
|
+
maintainVisibleContentPosition: { data: mvcpData, size: mvcpScroll }
|
|
1417
1417
|
} = props;
|
|
1418
1418
|
const scrollingTo = state.scrollingTo;
|
|
1419
1419
|
let prevPosition;
|
|
@@ -1421,7 +1421,7 @@ function prepareMVCP(ctx, dataChanged) {
|
|
|
1421
1421
|
const idsInViewWithPositions = [];
|
|
1422
1422
|
const scrollTarget = scrollingTo == null ? void 0 : scrollingTo.index;
|
|
1423
1423
|
const scrollingToViewPosition = scrollingTo == null ? void 0 : scrollingTo.viewPosition;
|
|
1424
|
-
const shouldMVCP = dataChanged ?
|
|
1424
|
+
const shouldMVCP = dataChanged ? mvcpData : mvcpScroll;
|
|
1425
1425
|
const indexByKey = state.indexByKey;
|
|
1426
1426
|
if (shouldMVCP) {
|
|
1427
1427
|
if (scrollTarget !== void 0) {
|
|
@@ -1447,7 +1447,7 @@ function prepareMVCP(ctx, dataChanged) {
|
|
|
1447
1447
|
}
|
|
1448
1448
|
return () => {
|
|
1449
1449
|
let positionDiff = 0;
|
|
1450
|
-
if (dataChanged && targetId === void 0 &&
|
|
1450
|
+
if (dataChanged && targetId === void 0 && mvcpData) {
|
|
1451
1451
|
for (let i = 0; i < idsInViewWithPositions.length; i++) {
|
|
1452
1452
|
const { id, position } = idsInViewWithPositions[i];
|
|
1453
1453
|
const newPosition = positions.get(id);
|
|
@@ -1484,7 +1484,7 @@ function prepareMVCP(ctx, dataChanged) {
|
|
|
1484
1484
|
}
|
|
1485
1485
|
}
|
|
1486
1486
|
if (Math.abs(positionDiff) > 0.1) {
|
|
1487
|
-
requestAdjust(ctx, positionDiff, dataChanged &&
|
|
1487
|
+
requestAdjust(ctx, positionDiff, dataChanged && mvcpData);
|
|
1488
1488
|
}
|
|
1489
1489
|
};
|
|
1490
1490
|
}
|
|
@@ -3149,18 +3149,18 @@ function getRenderedItem(ctx, key) {
|
|
|
3149
3149
|
function normalizeMaintainVisibleContentPosition(value) {
|
|
3150
3150
|
var _a3, _b;
|
|
3151
3151
|
if (value === true) {
|
|
3152
|
-
return {
|
|
3152
|
+
return { data: true, size: true };
|
|
3153
3153
|
}
|
|
3154
3154
|
if (value && typeof value === "object") {
|
|
3155
3155
|
return {
|
|
3156
|
-
|
|
3157
|
-
|
|
3156
|
+
data: (_a3 = value.data) != null ? _a3 : false,
|
|
3157
|
+
size: (_b = value.size) != null ? _b : true
|
|
3158
3158
|
};
|
|
3159
3159
|
}
|
|
3160
3160
|
if (value === false) {
|
|
3161
|
-
return {
|
|
3161
|
+
return { data: false, size: false };
|
|
3162
3162
|
}
|
|
3163
|
-
return {
|
|
3163
|
+
return { data: false, size: true };
|
|
3164
3164
|
}
|
|
3165
3165
|
function useThrottleDebounce(mode) {
|
|
3166
3166
|
const timeoutRef = useRef(null);
|
|
@@ -3447,7 +3447,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
3447
3447
|
setPaddingTop(ctx, { stylePaddingTop: stylePaddingTopState });
|
|
3448
3448
|
refState.current.props.stylePaddingBottom = stylePaddingBottomState;
|
|
3449
3449
|
let paddingDiff = stylePaddingTopState - prevPaddingTop;
|
|
3450
|
-
if (maintainVisibleContentPositionConfig.
|
|
3450
|
+
if (maintainVisibleContentPositionConfig.size && paddingDiff && prevPaddingTop !== void 0 && Platform2.OS === "ios") {
|
|
3451
3451
|
if (state.scroll < 0) {
|
|
3452
3452
|
paddingDiff += state.scroll;
|
|
3453
3453
|
}
|
|
@@ -223,7 +223,7 @@ interface LegendListSpecificProps<ItemT, TItemType extends string | undefined> {
|
|
|
223
223
|
/**
|
|
224
224
|
* Maintains visibility of content.
|
|
225
225
|
* - scroll (default: true) stabilizes during size/layout changes while scrolling.
|
|
226
|
-
* -
|
|
226
|
+
* - data (default: false) stabilizes when the data array changes; passing true also sets the RN maintainVisibleContentPosition prop.
|
|
227
227
|
* - undefined (default) enables scroll stabilization but skips data-change anchoring.
|
|
228
228
|
* - true enables both behaviors; false disables both.
|
|
229
229
|
*/
|
|
@@ -346,12 +346,12 @@ interface LegendListSpecificProps<ItemT, TItemType extends string | undefined> {
|
|
|
346
346
|
}
|
|
347
347
|
type LegendListPropsBase<ItemT, TScrollView extends ComponentProps<typeof ScrollView> | ComponentProps<typeof Animated.ScrollView> | ComponentProps<typeof Reanimated.ScrollView>, TItemType extends string | undefined = string | undefined> = BaseScrollViewProps<TScrollView> & LegendListSpecificProps<ItemT, TItemType> & (DataModeProps<ItemT, TItemType> | ChildrenModeProps);
|
|
348
348
|
interface MaintainVisibleContentPositionConfig {
|
|
349
|
-
|
|
350
|
-
|
|
349
|
+
data?: boolean;
|
|
350
|
+
size?: boolean;
|
|
351
351
|
}
|
|
352
352
|
interface MaintainVisibleContentPositionNormalized {
|
|
353
|
-
|
|
354
|
-
|
|
353
|
+
data: boolean;
|
|
354
|
+
size: boolean;
|
|
355
355
|
}
|
|
356
356
|
interface MaintainScrollAtEndOptions {
|
|
357
357
|
onLayout?: boolean;
|
|
@@ -223,7 +223,7 @@ interface LegendListSpecificProps<ItemT, TItemType extends string | undefined> {
|
|
|
223
223
|
/**
|
|
224
224
|
* Maintains visibility of content.
|
|
225
225
|
* - scroll (default: true) stabilizes during size/layout changes while scrolling.
|
|
226
|
-
* -
|
|
226
|
+
* - data (default: false) stabilizes when the data array changes; passing true also sets the RN maintainVisibleContentPosition prop.
|
|
227
227
|
* - undefined (default) enables scroll stabilization but skips data-change anchoring.
|
|
228
228
|
* - true enables both behaviors; false disables both.
|
|
229
229
|
*/
|
|
@@ -346,12 +346,12 @@ interface LegendListSpecificProps<ItemT, TItemType extends string | undefined> {
|
|
|
346
346
|
}
|
|
347
347
|
type LegendListPropsBase<ItemT, TScrollView extends ComponentProps<typeof ScrollView> | ComponentProps<typeof Animated.ScrollView> | ComponentProps<typeof Reanimated.ScrollView>, TItemType extends string | undefined = string | undefined> = BaseScrollViewProps<TScrollView> & LegendListSpecificProps<ItemT, TItemType> & (DataModeProps<ItemT, TItemType> | ChildrenModeProps);
|
|
348
348
|
interface MaintainVisibleContentPositionConfig {
|
|
349
|
-
|
|
350
|
-
|
|
349
|
+
data?: boolean;
|
|
350
|
+
size?: boolean;
|
|
351
351
|
}
|
|
352
352
|
interface MaintainVisibleContentPositionNormalized {
|
|
353
|
-
|
|
354
|
-
|
|
353
|
+
data: boolean;
|
|
354
|
+
size: boolean;
|
|
355
355
|
}
|
|
356
356
|
interface MaintainScrollAtEndOptions {
|
|
357
357
|
onLayout?: boolean;
|