@legendapp/list 3.0.0-beta.50 → 3.0.0-beta.52
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/index.js +59 -36
- package/index.mjs +59 -36
- package/index.native.js +59 -36
- package/index.native.mjs +59 -36
- package/keyboard-chat.d.ts +22 -2
- package/keyboard-chat.js +33 -4
- package/keyboard-chat.mjs +35 -7
- package/keyboard-test.d.ts +2 -1
- package/keyboard-test.js +22 -4
- package/keyboard-test.mjs +19 -5
- package/package.json +1 -1
- package/react-native.js +59 -36
- package/react-native.mjs +59 -36
- package/react-native.web.js +59 -36
- package/react-native.web.mjs +59 -36
- package/react.js +59 -36
- package/react.mjs +59 -36
- package/reanimated.js +0 -4
- package/reanimated.mjs +0 -4
package/react.mjs
CHANGED
|
@@ -5082,12 +5082,14 @@ function handleLayout(ctx, layoutParam, setCanRender) {
|
|
|
5082
5082
|
}
|
|
5083
5083
|
|
|
5084
5084
|
// src/core/updateScroll.ts
|
|
5085
|
-
function updateScroll(ctx, newScroll, forceUpdate) {
|
|
5085
|
+
function updateScroll(ctx, newScroll, forceUpdate, options) {
|
|
5086
5086
|
var _a3;
|
|
5087
5087
|
const state = ctx.state;
|
|
5088
5088
|
const { ignoreScrollFromMVCP, lastScrollAdjustForHistory, scrollAdjustHandler, scrollHistory, scrollingTo } = state;
|
|
5089
5089
|
const prevScroll = state.scroll;
|
|
5090
|
-
|
|
5090
|
+
if ((options == null ? void 0 : options.markHasScrolled) !== false) {
|
|
5091
|
+
state.hasScrolled = true;
|
|
5092
|
+
}
|
|
5091
5093
|
state.lastBatchingAction = Date.now();
|
|
5092
5094
|
const currentTime = Date.now();
|
|
5093
5095
|
const adjust = scrollAdjustHandler.getAdjust();
|
|
@@ -5306,13 +5308,12 @@ function maybeUpdateAnchoredEndSpace(ctx) {
|
|
|
5306
5308
|
nextSize = Math.max(0, state.scrollLength - contentBelowAnchor - anchorOffset);
|
|
5307
5309
|
}
|
|
5308
5310
|
}
|
|
5309
|
-
if (previousSize
|
|
5310
|
-
|
|
5311
|
-
|
|
5312
|
-
|
|
5313
|
-
|
|
5314
|
-
|
|
5315
|
-
updateScroll(ctx, state.scroll, true);
|
|
5311
|
+
if (previousSize !== nextSize) {
|
|
5312
|
+
set$(ctx, "anchoredEndSpaceSize", nextSize);
|
|
5313
|
+
(_a3 = anchoredEndSpace == null ? void 0 : anchoredEndSpace.onSizeChanged) == null ? void 0 : _a3.call(anchoredEndSpace, nextSize);
|
|
5314
|
+
if (anchoredEndSpace == null ? void 0 : anchoredEndSpace.includeInEndInset) {
|
|
5315
|
+
updateScroll(ctx, state.scroll, true);
|
|
5316
|
+
}
|
|
5316
5317
|
}
|
|
5317
5318
|
return nextSize;
|
|
5318
5319
|
}
|
|
@@ -5541,14 +5542,14 @@ function createImperativeHandle(ctx) {
|
|
|
5541
5542
|
const IMPERATIVE_SCROLL_SETTLE_STABLE_FRAMES = 2;
|
|
5542
5543
|
let imperativeScrollToken = 0;
|
|
5543
5544
|
const isSettlingAfterDataChange = () => !!state.didDataChange || !!state.didColumnsChange || state.queuedMVCPRecalculate !== void 0 || state.ignoreScrollFromMVCP !== void 0;
|
|
5544
|
-
const
|
|
5545
|
+
const runWhenReady = (token, run, isReady) => {
|
|
5545
5546
|
const startedAt = Date.now();
|
|
5546
5547
|
let stableFrames = 0;
|
|
5547
5548
|
const check = () => {
|
|
5548
5549
|
if (token !== imperativeScrollToken) {
|
|
5549
5550
|
return;
|
|
5550
5551
|
}
|
|
5551
|
-
if (isSettlingAfterDataChange()) {
|
|
5552
|
+
if (isSettlingAfterDataChange() || !isReady()) {
|
|
5552
5553
|
stableFrames = 0;
|
|
5553
5554
|
} else {
|
|
5554
5555
|
stableFrames += 1;
|
|
@@ -5563,10 +5564,10 @@ function createImperativeHandle(ctx) {
|
|
|
5563
5564
|
requestAnimationFrame(check);
|
|
5564
5565
|
};
|
|
5565
5566
|
const runScrollWithPromise = (run, options) => new Promise((resolve) => {
|
|
5566
|
-
var _a3;
|
|
5567
|
+
var _a3, _b;
|
|
5567
5568
|
const token = ++imperativeScrollToken;
|
|
5568
|
-
const
|
|
5569
|
-
(
|
|
5569
|
+
const isReady = (_a3 = options == null ? void 0 : options.isReady) != null ? _a3 : (() => true);
|
|
5570
|
+
(_b = state.pendingScrollResolve) == null ? void 0 : _b.call(state);
|
|
5570
5571
|
state.pendingScrollResolve = resolve;
|
|
5571
5572
|
const runNow = () => {
|
|
5572
5573
|
if (token !== imperativeScrollToken) {
|
|
@@ -5580,11 +5581,10 @@ function createImperativeHandle(ctx) {
|
|
|
5580
5581
|
resolve();
|
|
5581
5582
|
}
|
|
5582
5583
|
};
|
|
5583
|
-
|
|
5584
|
-
|
|
5585
|
-
runWhenSettled(token, execute);
|
|
5584
|
+
if (isSettlingAfterDataChange() || !isReady()) {
|
|
5585
|
+
runWhenReady(token, runNow, isReady);
|
|
5586
5586
|
} else {
|
|
5587
|
-
|
|
5587
|
+
runNow();
|
|
5588
5588
|
}
|
|
5589
5589
|
});
|
|
5590
5590
|
const scrollIndexIntoView = (options) => {
|
|
@@ -5666,7 +5666,7 @@ function createImperativeHandle(ctx) {
|
|
|
5666
5666
|
}),
|
|
5667
5667
|
reportContentInset: (inset) => {
|
|
5668
5668
|
state.contentInsetOverride = inset != null ? inset : void 0;
|
|
5669
|
-
updateScroll(ctx, state.scroll, true);
|
|
5669
|
+
updateScroll(ctx, state.scroll, true, { markHasScrolled: false });
|
|
5670
5670
|
},
|
|
5671
5671
|
scrollIndexIntoView: (options) => runScrollWithPromise(() => scrollIndexIntoView(options)),
|
|
5672
5672
|
scrollItemIntoView: ({ item, ...props }) => runScrollWithPromise(() => {
|
|
@@ -5695,15 +5695,24 @@ function createImperativeHandle(ctx) {
|
|
|
5695
5695
|
}
|
|
5696
5696
|
return false;
|
|
5697
5697
|
}),
|
|
5698
|
-
scrollToIndex: (params) =>
|
|
5699
|
-
|
|
5698
|
+
scrollToIndex: (params) => {
|
|
5699
|
+
const shouldWaitForOutOfRangeTarget = params.index >= 0 && params.index >= state.props.data.length;
|
|
5700
|
+
const options = shouldWaitForOutOfRangeTarget ? {
|
|
5701
|
+
isReady: () => {
|
|
5702
|
+
var _a3;
|
|
5703
|
+
const props = state.props;
|
|
5704
|
+
const anchorIndex = (_a3 = props.anchoredEndSpace) == null ? void 0 : _a3.anchorIndex;
|
|
5705
|
+
const lastIndex = props.data.length - 1;
|
|
5706
|
+
const isInRange = params.index < props.data.length;
|
|
5707
|
+
const shouldWaitForAnchorSize = isInRange && anchorIndex !== void 0 && anchorIndex >= 0 && params.index >= anchorIndex && !props.getFixedItemSize && !state.sizesKnown.has(getId(state, lastIndex));
|
|
5708
|
+
return isInRange && !shouldWaitForAnchorSize;
|
|
5709
|
+
}
|
|
5710
|
+
} : void 0;
|
|
5711
|
+
return runScrollWithPromise(() => {
|
|
5700
5712
|
scrollToIndex(ctx, params);
|
|
5701
5713
|
return true;
|
|
5702
|
-
},
|
|
5703
|
-
|
|
5704
|
-
shouldWaitOneFrame: params.index >= 0 && params.index >= state.props.data.length
|
|
5705
|
-
}
|
|
5706
|
-
),
|
|
5714
|
+
}, options);
|
|
5715
|
+
},
|
|
5707
5716
|
scrollToItem: ({ item, ...props }) => runScrollWithPromise(() => {
|
|
5708
5717
|
const data = state.props.data;
|
|
5709
5718
|
const index = data.indexOf(item);
|
|
@@ -5735,32 +5744,32 @@ var addIndex = (result, dataLength, index) => {
|
|
|
5735
5744
|
result.add(index);
|
|
5736
5745
|
}
|
|
5737
5746
|
};
|
|
5738
|
-
function getAlwaysRenderIndices(config, data, keyExtractor) {
|
|
5747
|
+
function getAlwaysRenderIndices(config, data, keyExtractor, anchoredEndSpaceAnchorIndex) {
|
|
5739
5748
|
var _a3, _b;
|
|
5740
|
-
if (
|
|
5749
|
+
if (data.length === 0) {
|
|
5741
5750
|
return [];
|
|
5742
5751
|
}
|
|
5743
5752
|
const result = /* @__PURE__ */ new Set();
|
|
5744
5753
|
const dataLength = data.length;
|
|
5745
|
-
const topCount = toCount(config.top);
|
|
5754
|
+
const topCount = toCount(config == null ? void 0 : config.top);
|
|
5746
5755
|
if (topCount > 0) {
|
|
5747
5756
|
for (let i = 0; i < Math.min(topCount, dataLength); i++) {
|
|
5748
5757
|
addIndex(result, dataLength, i);
|
|
5749
5758
|
}
|
|
5750
5759
|
}
|
|
5751
|
-
const bottomCount = toCount(config.bottom);
|
|
5760
|
+
const bottomCount = toCount(config == null ? void 0 : config.bottom);
|
|
5752
5761
|
if (bottomCount > 0) {
|
|
5753
5762
|
for (let i = Math.max(0, dataLength - bottomCount); i < dataLength; i++) {
|
|
5754
5763
|
addIndex(result, dataLength, i);
|
|
5755
5764
|
}
|
|
5756
5765
|
}
|
|
5757
|
-
if ((_a3 = config.indices) == null ? void 0 : _a3.length) {
|
|
5766
|
+
if ((_a3 = config == null ? void 0 : config.indices) == null ? void 0 : _a3.length) {
|
|
5758
5767
|
for (const index of config.indices) {
|
|
5759
5768
|
if (!Number.isFinite(index)) continue;
|
|
5760
5769
|
addIndex(result, dataLength, Math.floor(index));
|
|
5761
5770
|
}
|
|
5762
5771
|
}
|
|
5763
|
-
if ((_b = config.keys) == null ? void 0 : _b.length) {
|
|
5772
|
+
if ((_b = config == null ? void 0 : config.keys) == null ? void 0 : _b.length) {
|
|
5764
5773
|
const keys = new Set(config.keys);
|
|
5765
5774
|
for (let i = 0; i < dataLength && keys.size > 0; i++) {
|
|
5766
5775
|
const key = keyExtractor(data[i], i);
|
|
@@ -5770,6 +5779,12 @@ function getAlwaysRenderIndices(config, data, keyExtractor) {
|
|
|
5770
5779
|
}
|
|
5771
5780
|
}
|
|
5772
5781
|
}
|
|
5782
|
+
if (anchoredEndSpaceAnchorIndex !== void 0 && Number.isFinite(anchoredEndSpaceAnchorIndex)) {
|
|
5783
|
+
const anchorIndex = Math.floor(anchoredEndSpaceAnchorIndex);
|
|
5784
|
+
for (let i = anchorIndex >= 0 ? anchorIndex : dataLength; i < dataLength; i++) {
|
|
5785
|
+
addIndex(result, dataLength, i);
|
|
5786
|
+
}
|
|
5787
|
+
}
|
|
5773
5788
|
const indices = Array.from(result);
|
|
5774
5789
|
indices.sort(sortAsc);
|
|
5775
5790
|
return indices;
|
|
@@ -5933,7 +5948,7 @@ var LegendList = typedMemo(
|
|
|
5933
5948
|
})
|
|
5934
5949
|
);
|
|
5935
5950
|
var LegendListInner = typedForwardRef(function LegendListInner2(props, forwardedRef) {
|
|
5936
|
-
var _a3, _b, _c, _d, _e, _f, _g, _h;
|
|
5951
|
+
var _a3, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
5937
5952
|
const noopOnScroll = useCallback((_event) => {
|
|
5938
5953
|
}, []);
|
|
5939
5954
|
if (props.recycleItems === void 0) {
|
|
@@ -6062,9 +6077,10 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
6062
6077
|
const keyExtractor = keyExtractorProp != null ? keyExtractorProp : ((_item, index) => index.toString());
|
|
6063
6078
|
const stickyHeaderIndices = stickyHeaderIndicesProp != null ? stickyHeaderIndicesProp : stickyIndicesDeprecated;
|
|
6064
6079
|
const alwaysRenderIndices = useMemo(() => {
|
|
6065
|
-
const indices = getAlwaysRenderIndices(alwaysRender, dataProp, keyExtractor);
|
|
6080
|
+
const indices = getAlwaysRenderIndices(alwaysRender, dataProp, keyExtractor, anchoredEndSpace == null ? void 0 : anchoredEndSpace.anchorIndex);
|
|
6066
6081
|
return { arr: indices, set: new Set(indices) };
|
|
6067
6082
|
}, [
|
|
6083
|
+
anchoredEndSpace == null ? void 0 : anchoredEndSpace.anchorIndex,
|
|
6068
6084
|
alwaysRender == null ? void 0 : alwaysRender.top,
|
|
6069
6085
|
alwaysRender == null ? void 0 : alwaysRender.bottom,
|
|
6070
6086
|
(_d = alwaysRender == null ? void 0 : alwaysRender.indices) == null ? void 0 : _d.join(","),
|
|
@@ -6170,6 +6186,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
6170
6186
|
const throttledOnScroll = useThrottledOnScroll(onScrollProp != null ? onScrollProp : noopOnScroll, scrollEventThrottle != null ? scrollEventThrottle : 0);
|
|
6171
6187
|
const throttleScrollFn = scrollEventThrottle && onScrollProp ? throttledOnScroll : onScrollProp;
|
|
6172
6188
|
const anchoredEndSpaceResolved = anchoredEndSpace ? { ...anchoredEndSpace, includeInEndInset: true } : anchoredEndSpace;
|
|
6189
|
+
const didAnchoredEndSpaceAnchorIndexChange = !isFirstLocal && !didDataChangeLocal && ((_g = state.props.anchoredEndSpace) == null ? void 0 : _g.anchorIndex) !== (anchoredEndSpaceResolved == null ? void 0 : anchoredEndSpaceResolved.anchorIndex);
|
|
6173
6190
|
state.props = {
|
|
6174
6191
|
alignItemsAtEnd,
|
|
6175
6192
|
alwaysRender,
|
|
@@ -6279,6 +6296,11 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
6279
6296
|
});
|
|
6280
6297
|
}, [dataProp.length, didDataChangeLocal, initialScrollAtEnd, stylePaddingBottomState, usesBootstrapInitialScroll]);
|
|
6281
6298
|
useLayoutEffect(() => {
|
|
6299
|
+
var _a4;
|
|
6300
|
+
if (didAnchoredEndSpaceAnchorIndexChange) {
|
|
6301
|
+
state.scrollForNextCalculateItemsInView = void 0;
|
|
6302
|
+
(_a4 = state.triggerCalculateItemsInView) == null ? void 0 : _a4.call(state);
|
|
6303
|
+
}
|
|
6282
6304
|
maybeUpdateAnchoredEndSpace(ctx);
|
|
6283
6305
|
}, [
|
|
6284
6306
|
ctx,
|
|
@@ -6287,6 +6309,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
6287
6309
|
anchoredEndSpace == null ? void 0 : anchoredEndSpace.anchorIndex,
|
|
6288
6310
|
anchoredEndSpace == null ? void 0 : anchoredEndSpace.anchorMaxSize,
|
|
6289
6311
|
anchoredEndSpace == null ? void 0 : anchoredEndSpace.anchorOffset,
|
|
6312
|
+
didAnchoredEndSpaceAnchorIndexChange,
|
|
6290
6313
|
numColumnsProp
|
|
6291
6314
|
]);
|
|
6292
6315
|
const onLayoutFooter = useCallback(
|
|
@@ -6440,7 +6463,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
6440
6463
|
onScroll: onScrollHandler,
|
|
6441
6464
|
recycleItems,
|
|
6442
6465
|
refreshControl: refreshControlElement ? stylePaddingTopState > 0 ? React3.cloneElement(refreshControlElement, {
|
|
6443
|
-
progressViewOffset: ((
|
|
6466
|
+
progressViewOffset: ((_h = refreshControlElement.props.progressViewOffset) != null ? _h : 0) + stylePaddingTopState
|
|
6444
6467
|
}) : refreshControlElement : onRefresh && /* @__PURE__ */ React3.createElement(
|
|
6445
6468
|
RefreshControl,
|
|
6446
6469
|
{
|
|
@@ -6451,7 +6474,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
6451
6474
|
),
|
|
6452
6475
|
refScrollView: combinedRef,
|
|
6453
6476
|
renderScrollComponent,
|
|
6454
|
-
scrollAdjustHandler: (
|
|
6477
|
+
scrollAdjustHandler: (_i = refState.current) == null ? void 0 : _i.scrollAdjustHandler,
|
|
6455
6478
|
scrollEventThrottle: 0,
|
|
6456
6479
|
snapToIndices,
|
|
6457
6480
|
stickyHeaderIndices,
|
package/reanimated.js
CHANGED
|
@@ -137,10 +137,6 @@ function setSharedValueValue(sharedValue, value) {
|
|
|
137
137
|
return;
|
|
138
138
|
}
|
|
139
139
|
const sharedValueWithMethods = sharedValue;
|
|
140
|
-
const currentValue = typeof sharedValueWithMethods.get === "function" ? sharedValueWithMethods.get() : sharedValueWithMethods.value;
|
|
141
|
-
if (currentValue === value) {
|
|
142
|
-
return;
|
|
143
|
-
}
|
|
144
140
|
if (typeof sharedValueWithMethods.set === "function") {
|
|
145
141
|
sharedValueWithMethods.set(value);
|
|
146
142
|
} else {
|
package/reanimated.mjs
CHANGED
|
@@ -113,10 +113,6 @@ function setSharedValueValue(sharedValue, value) {
|
|
|
113
113
|
return;
|
|
114
114
|
}
|
|
115
115
|
const sharedValueWithMethods = sharedValue;
|
|
116
|
-
const currentValue = typeof sharedValueWithMethods.get === "function" ? sharedValueWithMethods.get() : sharedValueWithMethods.value;
|
|
117
|
-
if (currentValue === value) {
|
|
118
|
-
return;
|
|
119
|
-
}
|
|
120
116
|
if (typeof sharedValueWithMethods.set === "function") {
|
|
121
117
|
sharedValueWithMethods.set(value);
|
|
122
118
|
} else {
|