@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/keyboard-chat.mjs
CHANGED
|
@@ -1,12 +1,33 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { useEffect, useMemo, useCallback } from 'react';
|
|
3
|
-
import { KeyboardChatScrollView } from 'react-native-keyboard-controller';
|
|
2
|
+
import { useRef, useEffect, useMemo, useCallback } from 'react';
|
|
3
|
+
import { KeyboardChatScrollView, KeyboardController } from 'react-native-keyboard-controller';
|
|
4
4
|
import { useSharedValue } from 'react-native-reanimated';
|
|
5
5
|
import { internal } from '@legendapp/list/react-native';
|
|
6
6
|
import { AnimatedLegendList } from '@legendapp/list/reanimated';
|
|
7
7
|
|
|
8
8
|
// src/integrations/keyboard-chat.tsx
|
|
9
|
-
var { typedForwardRef } = internal;
|
|
9
|
+
var { typedForwardRef, useCombinedRef } = internal;
|
|
10
|
+
function useKeyboardScrollToEnd({ freeze: freezeProp, listRef }) {
|
|
11
|
+
const internalFreeze = useSharedValue(false);
|
|
12
|
+
const freeze = freezeProp != null ? freezeProp : internalFreeze;
|
|
13
|
+
const scrollMessageToEnd = useCallback(
|
|
14
|
+
async ({ animated, closeKeyboard }) => {
|
|
15
|
+
const listRefCurrent = listRef.current;
|
|
16
|
+
if (listRefCurrent) {
|
|
17
|
+
freeze.set(true);
|
|
18
|
+
const dismissPromise = closeKeyboard && KeyboardController.dismiss();
|
|
19
|
+
const scrollPromise = listRefCurrent.scrollToEnd({ animated });
|
|
20
|
+
await Promise.all([scrollPromise, dismissPromise]);
|
|
21
|
+
freeze.set(false);
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
[freeze, listRef]
|
|
25
|
+
);
|
|
26
|
+
return {
|
|
27
|
+
freeze,
|
|
28
|
+
scrollMessageToEnd
|
|
29
|
+
};
|
|
30
|
+
}
|
|
10
31
|
var KeyboardChatLegendList = typedForwardRef(function KeyboardChatLegendList2(props, forwardedRef) {
|
|
11
32
|
const {
|
|
12
33
|
anchoredEndSpace,
|
|
@@ -17,6 +38,8 @@ var KeyboardChatLegendList = typedForwardRef(function KeyboardChatLegendList2(pr
|
|
|
17
38
|
offset,
|
|
18
39
|
...rest
|
|
19
40
|
} = props;
|
|
41
|
+
const refLegendList = useRef(null);
|
|
42
|
+
const combinedRef = useCombinedRef(forwardedRef, refLegendList);
|
|
20
43
|
const blankSpace = useSharedValue(0);
|
|
21
44
|
useEffect(() => {
|
|
22
45
|
if (!anchoredEndSpace) {
|
|
@@ -37,6 +60,10 @@ var KeyboardChatLegendList = typedForwardRef(function KeyboardChatLegendList2(pr
|
|
|
37
60
|
}
|
|
38
61
|
};
|
|
39
62
|
}, [anchoredEndSpace, blankSpace]);
|
|
63
|
+
const onContentInsetChange = useCallback((insets) => {
|
|
64
|
+
var _a;
|
|
65
|
+
(_a = refLegendList.current) == null ? void 0 : _a.reportContentInset(insets);
|
|
66
|
+
}, []);
|
|
40
67
|
const memoList = useCallback(
|
|
41
68
|
(scrollProps) => {
|
|
42
69
|
return /* @__PURE__ */ React.createElement(
|
|
@@ -46,9 +73,9 @@ var KeyboardChatLegendList = typedForwardRef(function KeyboardChatLegendList2(pr
|
|
|
46
73
|
applyWorkaroundForContentInsetHitTestBug,
|
|
47
74
|
blankSpace,
|
|
48
75
|
extraContentPadding,
|
|
49
|
-
freeze,
|
|
50
76
|
keyboardLiftBehavior,
|
|
51
|
-
offset
|
|
77
|
+
offset,
|
|
78
|
+
onContentInsetChange
|
|
52
79
|
}
|
|
53
80
|
);
|
|
54
81
|
},
|
|
@@ -58,6 +85,7 @@ var KeyboardChatLegendList = typedForwardRef(function KeyboardChatLegendList2(pr
|
|
|
58
85
|
extraContentPadding,
|
|
59
86
|
freeze,
|
|
60
87
|
keyboardLiftBehavior,
|
|
88
|
+
onContentInsetChange,
|
|
61
89
|
offset
|
|
62
90
|
]
|
|
63
91
|
);
|
|
@@ -66,11 +94,11 @@ var KeyboardChatLegendList = typedForwardRef(function KeyboardChatLegendList2(pr
|
|
|
66
94
|
AnimatedLegendListInternal,
|
|
67
95
|
{
|
|
68
96
|
anchoredEndSpace: anchoredEndSpaceWithBlankSpace,
|
|
69
|
-
ref:
|
|
97
|
+
ref: combinedRef,
|
|
70
98
|
renderScrollComponent: memoList,
|
|
71
99
|
...rest
|
|
72
100
|
}
|
|
73
101
|
);
|
|
74
102
|
});
|
|
75
103
|
|
|
76
|
-
export { KeyboardChatLegendList };
|
|
104
|
+
export { KeyboardChatLegendList, useKeyboardScrollToEnd };
|
package/keyboard-test.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { ScrollViewComponent, ScrollResponderMixin, Insets as Insets$1, ScrollViewProps } from 'react-native';
|
|
3
3
|
import { KeyboardChatScrollViewProps } from 'react-native-keyboard-controller';
|
|
4
|
+
export { useKeyboardScrollToEnd } from '@legendapp/list/keyboard-chat';
|
|
4
5
|
import { AnimatedLegendListProps } from '@legendapp/list/reanimated';
|
|
5
6
|
|
|
6
7
|
interface MaintainVisibleContentPositionNormalized<ItemT = any> {
|
|
@@ -210,7 +211,7 @@ type LegendListRef = Omit<LegendListRef$1, "getNativeScrollRef" | "getScrollResp
|
|
|
210
211
|
reportContentInset(inset?: Partial<Insets$1> | null): void;
|
|
211
212
|
};
|
|
212
213
|
|
|
213
|
-
type KeyboardChatScrollViewPropsUnique = Omit<KeyboardChatScrollViewProps, keyof ScrollViewProps | "inverted" | "ScrollViewComponent">;
|
|
214
|
+
type KeyboardChatScrollViewPropsUnique = Omit<KeyboardChatScrollViewProps, keyof ScrollViewProps | "inverted" | "ScrollViewComponent" | "onContentInsetChange">;
|
|
214
215
|
declare const KeyboardAvoidingLegendList: <ItemT>(props: Omit<AnimatedLegendListProps<ItemT>, "renderScrollComponent"> & KeyboardChatScrollViewPropsUnique & React.RefAttributes<LegendListRef>) => React.ReactElement | null;
|
|
215
216
|
|
|
216
217
|
export { KeyboardAvoidingLegendList };
|
package/keyboard-test.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
var React = require('react');
|
|
4
4
|
var reactNativeKeyboardController = require('react-native-keyboard-controller');
|
|
5
|
+
var keyboardChat = require('@legendapp/list/keyboard-chat');
|
|
5
6
|
var reactNative = require('@legendapp/list/react-native');
|
|
6
7
|
var reanimated = require('@legendapp/list/reanimated');
|
|
7
8
|
|
|
@@ -26,14 +27,31 @@ function _interopNamespace(e) {
|
|
|
26
27
|
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
27
28
|
|
|
28
29
|
// src/integrations/keyboard-test.tsx
|
|
29
|
-
var { typedForwardRef } = reactNative.internal;
|
|
30
|
+
var { typedForwardRef, useCombinedRef } = reactNative.internal;
|
|
30
31
|
var KeyboardAvoidingLegendList = typedForwardRef(function KeyboardAvoidingLegendList2(props, forwardedRef) {
|
|
31
32
|
const { extraContentPadding, ...rest } = props;
|
|
33
|
+
const refLegendList = React.useRef(null);
|
|
34
|
+
const combinedRef = useCombinedRef(forwardedRef, refLegendList);
|
|
35
|
+
const onContentInsetChange = React.useCallback((insets) => {
|
|
36
|
+
var _a;
|
|
37
|
+
(_a = refLegendList.current) == null ? void 0 : _a.reportContentInset(insets);
|
|
38
|
+
}, []);
|
|
32
39
|
const memoList = React.useCallback(
|
|
33
|
-
(listProps) => /* @__PURE__ */ React__namespace.createElement(
|
|
34
|
-
|
|
40
|
+
(listProps) => /* @__PURE__ */ React__namespace.createElement(
|
|
41
|
+
reactNativeKeyboardController.KeyboardChatScrollView,
|
|
42
|
+
{
|
|
43
|
+
...listProps,
|
|
44
|
+
extraContentPadding,
|
|
45
|
+
onContentInsetChange
|
|
46
|
+
}
|
|
47
|
+
),
|
|
48
|
+
[extraContentPadding, onContentInsetChange]
|
|
35
49
|
);
|
|
36
|
-
return /* @__PURE__ */ React__namespace.createElement(reanimated.AnimatedLegendList, { ref:
|
|
50
|
+
return /* @__PURE__ */ React__namespace.createElement(reanimated.AnimatedLegendList, { ref: combinedRef, renderScrollComponent: memoList, ...rest });
|
|
37
51
|
});
|
|
38
52
|
|
|
53
|
+
Object.defineProperty(exports, "useKeyboardScrollToEnd", {
|
|
54
|
+
enumerable: true,
|
|
55
|
+
get: function () { return keyboardChat.useKeyboardScrollToEnd; }
|
|
56
|
+
});
|
|
39
57
|
exports.KeyboardAvoidingLegendList = KeyboardAvoidingLegendList;
|
package/keyboard-test.mjs
CHANGED
|
@@ -1,18 +1,32 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { useCallback } from 'react';
|
|
2
|
+
import { useRef, useCallback } from 'react';
|
|
3
3
|
import { KeyboardChatScrollView } from 'react-native-keyboard-controller';
|
|
4
|
+
export { useKeyboardScrollToEnd } from '@legendapp/list/keyboard-chat';
|
|
4
5
|
import { internal } from '@legendapp/list/react-native';
|
|
5
6
|
import { AnimatedLegendList } from '@legendapp/list/reanimated';
|
|
6
7
|
|
|
7
8
|
// src/integrations/keyboard-test.tsx
|
|
8
|
-
var { typedForwardRef } = internal;
|
|
9
|
+
var { typedForwardRef, useCombinedRef } = internal;
|
|
9
10
|
var KeyboardAvoidingLegendList = typedForwardRef(function KeyboardAvoidingLegendList2(props, forwardedRef) {
|
|
10
11
|
const { extraContentPadding, ...rest } = props;
|
|
12
|
+
const refLegendList = useRef(null);
|
|
13
|
+
const combinedRef = useCombinedRef(forwardedRef, refLegendList);
|
|
14
|
+
const onContentInsetChange = useCallback((insets) => {
|
|
15
|
+
var _a;
|
|
16
|
+
(_a = refLegendList.current) == null ? void 0 : _a.reportContentInset(insets);
|
|
17
|
+
}, []);
|
|
11
18
|
const memoList = useCallback(
|
|
12
|
-
(listProps) => /* @__PURE__ */ React.createElement(
|
|
13
|
-
|
|
19
|
+
(listProps) => /* @__PURE__ */ React.createElement(
|
|
20
|
+
KeyboardChatScrollView,
|
|
21
|
+
{
|
|
22
|
+
...listProps,
|
|
23
|
+
extraContentPadding,
|
|
24
|
+
onContentInsetChange
|
|
25
|
+
}
|
|
26
|
+
),
|
|
27
|
+
[extraContentPadding, onContentInsetChange]
|
|
14
28
|
);
|
|
15
|
-
return /* @__PURE__ */ React.createElement(AnimatedLegendList, { ref:
|
|
29
|
+
return /* @__PURE__ */ React.createElement(AnimatedLegendList, { ref: combinedRef, renderScrollComponent: memoList, ...rest });
|
|
16
30
|
});
|
|
17
31
|
|
|
18
32
|
export { KeyboardAvoidingLegendList };
|
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.52",
|
|
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/react-native.js
CHANGED
|
@@ -4570,12 +4570,14 @@ var flushSync = (fn) => {
|
|
|
4570
4570
|
};
|
|
4571
4571
|
|
|
4572
4572
|
// src/core/updateScroll.ts
|
|
4573
|
-
function updateScroll(ctx, newScroll, forceUpdate) {
|
|
4573
|
+
function updateScroll(ctx, newScroll, forceUpdate, options) {
|
|
4574
4574
|
var _a3;
|
|
4575
4575
|
const state = ctx.state;
|
|
4576
4576
|
const { ignoreScrollFromMVCP, lastScrollAdjustForHistory, scrollAdjustHandler, scrollHistory, scrollingTo } = state;
|
|
4577
4577
|
const prevScroll = state.scroll;
|
|
4578
|
-
|
|
4578
|
+
if ((options == null ? void 0 : options.markHasScrolled) !== false) {
|
|
4579
|
+
state.hasScrolled = true;
|
|
4580
|
+
}
|
|
4579
4581
|
state.lastBatchingAction = Date.now();
|
|
4580
4582
|
const currentTime = Date.now();
|
|
4581
4583
|
const adjust = scrollAdjustHandler.getAdjust();
|
|
@@ -4794,13 +4796,12 @@ function maybeUpdateAnchoredEndSpace(ctx) {
|
|
|
4794
4796
|
nextSize = Math.max(0, state.scrollLength - contentBelowAnchor - anchorOffset);
|
|
4795
4797
|
}
|
|
4796
4798
|
}
|
|
4797
|
-
if (previousSize
|
|
4798
|
-
|
|
4799
|
-
|
|
4800
|
-
|
|
4801
|
-
|
|
4802
|
-
|
|
4803
|
-
updateScroll(ctx, state.scroll, true);
|
|
4799
|
+
if (previousSize !== nextSize) {
|
|
4800
|
+
set$(ctx, "anchoredEndSpaceSize", nextSize);
|
|
4801
|
+
(_a3 = anchoredEndSpace == null ? void 0 : anchoredEndSpace.onSizeChanged) == null ? void 0 : _a3.call(anchoredEndSpace, nextSize);
|
|
4802
|
+
if (anchoredEndSpace == null ? void 0 : anchoredEndSpace.includeInEndInset) {
|
|
4803
|
+
updateScroll(ctx, state.scroll, true);
|
|
4804
|
+
}
|
|
4804
4805
|
}
|
|
4805
4806
|
return nextSize;
|
|
4806
4807
|
}
|
|
@@ -5044,14 +5045,14 @@ function createImperativeHandle(ctx) {
|
|
|
5044
5045
|
const IMPERATIVE_SCROLL_SETTLE_STABLE_FRAMES = 2;
|
|
5045
5046
|
let imperativeScrollToken = 0;
|
|
5046
5047
|
const isSettlingAfterDataChange = () => !!state.didDataChange || !!state.didColumnsChange || state.queuedMVCPRecalculate !== void 0 || state.ignoreScrollFromMVCP !== void 0;
|
|
5047
|
-
const
|
|
5048
|
+
const runWhenReady = (token, run, isReady) => {
|
|
5048
5049
|
const startedAt = Date.now();
|
|
5049
5050
|
let stableFrames = 0;
|
|
5050
5051
|
const check = () => {
|
|
5051
5052
|
if (token !== imperativeScrollToken) {
|
|
5052
5053
|
return;
|
|
5053
5054
|
}
|
|
5054
|
-
if (isSettlingAfterDataChange()) {
|
|
5055
|
+
if (isSettlingAfterDataChange() || !isReady()) {
|
|
5055
5056
|
stableFrames = 0;
|
|
5056
5057
|
} else {
|
|
5057
5058
|
stableFrames += 1;
|
|
@@ -5066,10 +5067,10 @@ function createImperativeHandle(ctx) {
|
|
|
5066
5067
|
requestAnimationFrame(check);
|
|
5067
5068
|
};
|
|
5068
5069
|
const runScrollWithPromise = (run, options) => new Promise((resolve) => {
|
|
5069
|
-
var _a3;
|
|
5070
|
+
var _a3, _b;
|
|
5070
5071
|
const token = ++imperativeScrollToken;
|
|
5071
|
-
const
|
|
5072
|
-
(
|
|
5072
|
+
const isReady = (_a3 = options == null ? void 0 : options.isReady) != null ? _a3 : (() => true);
|
|
5073
|
+
(_b = state.pendingScrollResolve) == null ? void 0 : _b.call(state);
|
|
5073
5074
|
state.pendingScrollResolve = resolve;
|
|
5074
5075
|
const runNow = () => {
|
|
5075
5076
|
if (token !== imperativeScrollToken) {
|
|
@@ -5083,11 +5084,10 @@ function createImperativeHandle(ctx) {
|
|
|
5083
5084
|
resolve();
|
|
5084
5085
|
}
|
|
5085
5086
|
};
|
|
5086
|
-
|
|
5087
|
-
|
|
5088
|
-
runWhenSettled(token, execute);
|
|
5087
|
+
if (isSettlingAfterDataChange() || !isReady()) {
|
|
5088
|
+
runWhenReady(token, runNow, isReady);
|
|
5089
5089
|
} else {
|
|
5090
|
-
|
|
5090
|
+
runNow();
|
|
5091
5091
|
}
|
|
5092
5092
|
});
|
|
5093
5093
|
const scrollIndexIntoView = (options) => {
|
|
@@ -5169,7 +5169,7 @@ function createImperativeHandle(ctx) {
|
|
|
5169
5169
|
}),
|
|
5170
5170
|
reportContentInset: (inset) => {
|
|
5171
5171
|
state.contentInsetOverride = inset != null ? inset : void 0;
|
|
5172
|
-
updateScroll(ctx, state.scroll, true);
|
|
5172
|
+
updateScroll(ctx, state.scroll, true, { markHasScrolled: false });
|
|
5173
5173
|
},
|
|
5174
5174
|
scrollIndexIntoView: (options) => runScrollWithPromise(() => scrollIndexIntoView(options)),
|
|
5175
5175
|
scrollItemIntoView: ({ item, ...props }) => runScrollWithPromise(() => {
|
|
@@ -5198,15 +5198,24 @@ function createImperativeHandle(ctx) {
|
|
|
5198
5198
|
}
|
|
5199
5199
|
return false;
|
|
5200
5200
|
}),
|
|
5201
|
-
scrollToIndex: (params) =>
|
|
5202
|
-
|
|
5201
|
+
scrollToIndex: (params) => {
|
|
5202
|
+
const shouldWaitForOutOfRangeTarget = params.index >= 0 && params.index >= state.props.data.length;
|
|
5203
|
+
const options = shouldWaitForOutOfRangeTarget ? {
|
|
5204
|
+
isReady: () => {
|
|
5205
|
+
var _a3;
|
|
5206
|
+
const props = state.props;
|
|
5207
|
+
const anchorIndex = (_a3 = props.anchoredEndSpace) == null ? void 0 : _a3.anchorIndex;
|
|
5208
|
+
const lastIndex = props.data.length - 1;
|
|
5209
|
+
const isInRange = params.index < props.data.length;
|
|
5210
|
+
const shouldWaitForAnchorSize = isInRange && anchorIndex !== void 0 && anchorIndex >= 0 && params.index >= anchorIndex && !props.getFixedItemSize && !state.sizesKnown.has(getId(state, lastIndex));
|
|
5211
|
+
return isInRange && !shouldWaitForAnchorSize;
|
|
5212
|
+
}
|
|
5213
|
+
} : void 0;
|
|
5214
|
+
return runScrollWithPromise(() => {
|
|
5203
5215
|
scrollToIndex(ctx, params);
|
|
5204
5216
|
return true;
|
|
5205
|
-
},
|
|
5206
|
-
|
|
5207
|
-
shouldWaitOneFrame: params.index >= 0 && params.index >= state.props.data.length
|
|
5208
|
-
}
|
|
5209
|
-
),
|
|
5217
|
+
}, options);
|
|
5218
|
+
},
|
|
5210
5219
|
scrollToItem: ({ item, ...props }) => runScrollWithPromise(() => {
|
|
5211
5220
|
const data = state.props.data;
|
|
5212
5221
|
const index = data.indexOf(item);
|
|
@@ -5238,32 +5247,32 @@ var addIndex = (result, dataLength, index) => {
|
|
|
5238
5247
|
result.add(index);
|
|
5239
5248
|
}
|
|
5240
5249
|
};
|
|
5241
|
-
function getAlwaysRenderIndices(config, data, keyExtractor) {
|
|
5250
|
+
function getAlwaysRenderIndices(config, data, keyExtractor, anchoredEndSpaceAnchorIndex) {
|
|
5242
5251
|
var _a3, _b;
|
|
5243
|
-
if (
|
|
5252
|
+
if (data.length === 0) {
|
|
5244
5253
|
return [];
|
|
5245
5254
|
}
|
|
5246
5255
|
const result = /* @__PURE__ */ new Set();
|
|
5247
5256
|
const dataLength = data.length;
|
|
5248
|
-
const topCount = toCount(config.top);
|
|
5257
|
+
const topCount = toCount(config == null ? void 0 : config.top);
|
|
5249
5258
|
if (topCount > 0) {
|
|
5250
5259
|
for (let i = 0; i < Math.min(topCount, dataLength); i++) {
|
|
5251
5260
|
addIndex(result, dataLength, i);
|
|
5252
5261
|
}
|
|
5253
5262
|
}
|
|
5254
|
-
const bottomCount = toCount(config.bottom);
|
|
5263
|
+
const bottomCount = toCount(config == null ? void 0 : config.bottom);
|
|
5255
5264
|
if (bottomCount > 0) {
|
|
5256
5265
|
for (let i = Math.max(0, dataLength - bottomCount); i < dataLength; i++) {
|
|
5257
5266
|
addIndex(result, dataLength, i);
|
|
5258
5267
|
}
|
|
5259
5268
|
}
|
|
5260
|
-
if ((_a3 = config.indices) == null ? void 0 : _a3.length) {
|
|
5269
|
+
if ((_a3 = config == null ? void 0 : config.indices) == null ? void 0 : _a3.length) {
|
|
5261
5270
|
for (const index of config.indices) {
|
|
5262
5271
|
if (!Number.isFinite(index)) continue;
|
|
5263
5272
|
addIndex(result, dataLength, Math.floor(index));
|
|
5264
5273
|
}
|
|
5265
5274
|
}
|
|
5266
|
-
if ((_b = config.keys) == null ? void 0 : _b.length) {
|
|
5275
|
+
if ((_b = config == null ? void 0 : config.keys) == null ? void 0 : _b.length) {
|
|
5267
5276
|
const keys = new Set(config.keys);
|
|
5268
5277
|
for (let i = 0; i < dataLength && keys.size > 0; i++) {
|
|
5269
5278
|
const key = keyExtractor(data[i], i);
|
|
@@ -5273,6 +5282,12 @@ function getAlwaysRenderIndices(config, data, keyExtractor) {
|
|
|
5273
5282
|
}
|
|
5274
5283
|
}
|
|
5275
5284
|
}
|
|
5285
|
+
if (anchoredEndSpaceAnchorIndex !== void 0 && Number.isFinite(anchoredEndSpaceAnchorIndex)) {
|
|
5286
|
+
const anchorIndex = Math.floor(anchoredEndSpaceAnchorIndex);
|
|
5287
|
+
for (let i = anchorIndex >= 0 ? anchorIndex : dataLength; i < dataLength; i++) {
|
|
5288
|
+
addIndex(result, dataLength, i);
|
|
5289
|
+
}
|
|
5290
|
+
}
|
|
5276
5291
|
const indices = Array.from(result);
|
|
5277
5292
|
indices.sort(sortAsc);
|
|
5278
5293
|
return indices;
|
|
@@ -5436,7 +5451,7 @@ var LegendList = typedMemo(
|
|
|
5436
5451
|
})
|
|
5437
5452
|
);
|
|
5438
5453
|
var LegendListInner = typedForwardRef(function LegendListInner2(props, forwardedRef) {
|
|
5439
|
-
var _a3, _b, _c, _d, _e, _f, _g, _h;
|
|
5454
|
+
var _a3, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
5440
5455
|
const noopOnScroll = React2.useCallback((_event) => {
|
|
5441
5456
|
}, []);
|
|
5442
5457
|
if (props.recycleItems === void 0) {
|
|
@@ -5565,9 +5580,10 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
5565
5580
|
const keyExtractor = keyExtractorProp != null ? keyExtractorProp : ((_item, index) => index.toString());
|
|
5566
5581
|
const stickyHeaderIndices = stickyHeaderIndicesProp != null ? stickyHeaderIndicesProp : stickyIndicesDeprecated;
|
|
5567
5582
|
const alwaysRenderIndices = React2.useMemo(() => {
|
|
5568
|
-
const indices = getAlwaysRenderIndices(alwaysRender, dataProp, keyExtractor);
|
|
5583
|
+
const indices = getAlwaysRenderIndices(alwaysRender, dataProp, keyExtractor, anchoredEndSpace == null ? void 0 : anchoredEndSpace.anchorIndex);
|
|
5569
5584
|
return { arr: indices, set: new Set(indices) };
|
|
5570
5585
|
}, [
|
|
5586
|
+
anchoredEndSpace == null ? void 0 : anchoredEndSpace.anchorIndex,
|
|
5571
5587
|
alwaysRender == null ? void 0 : alwaysRender.top,
|
|
5572
5588
|
alwaysRender == null ? void 0 : alwaysRender.bottom,
|
|
5573
5589
|
(_d = alwaysRender == null ? void 0 : alwaysRender.indices) == null ? void 0 : _d.join(","),
|
|
@@ -5673,6 +5689,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
5673
5689
|
const throttledOnScroll = useThrottledOnScroll(onScrollProp != null ? onScrollProp : noopOnScroll, scrollEventThrottle != null ? scrollEventThrottle : 0);
|
|
5674
5690
|
const throttleScrollFn = scrollEventThrottle && onScrollProp ? throttledOnScroll : onScrollProp;
|
|
5675
5691
|
const anchoredEndSpaceResolved = Platform.OS === "web" && anchoredEndSpace ? { ...anchoredEndSpace, includeInEndInset: true } : anchoredEndSpace;
|
|
5692
|
+
const didAnchoredEndSpaceAnchorIndexChange = !isFirstLocal && !didDataChangeLocal && ((_g = state.props.anchoredEndSpace) == null ? void 0 : _g.anchorIndex) !== (anchoredEndSpaceResolved == null ? void 0 : anchoredEndSpaceResolved.anchorIndex);
|
|
5676
5693
|
state.props = {
|
|
5677
5694
|
alignItemsAtEnd,
|
|
5678
5695
|
alwaysRender,
|
|
@@ -5787,6 +5804,11 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
5787
5804
|
});
|
|
5788
5805
|
}, [dataProp.length, didDataChangeLocal, initialScrollAtEnd, stylePaddingBottomState, usesBootstrapInitialScroll]);
|
|
5789
5806
|
React2.useLayoutEffect(() => {
|
|
5807
|
+
var _a4;
|
|
5808
|
+
if (didAnchoredEndSpaceAnchorIndexChange) {
|
|
5809
|
+
state.scrollForNextCalculateItemsInView = void 0;
|
|
5810
|
+
(_a4 = state.triggerCalculateItemsInView) == null ? void 0 : _a4.call(state);
|
|
5811
|
+
}
|
|
5790
5812
|
maybeUpdateAnchoredEndSpace(ctx);
|
|
5791
5813
|
}, [
|
|
5792
5814
|
ctx,
|
|
@@ -5795,6 +5817,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
5795
5817
|
anchoredEndSpace == null ? void 0 : anchoredEndSpace.anchorIndex,
|
|
5796
5818
|
anchoredEndSpace == null ? void 0 : anchoredEndSpace.anchorMaxSize,
|
|
5797
5819
|
anchoredEndSpace == null ? void 0 : anchoredEndSpace.anchorOffset,
|
|
5820
|
+
didAnchoredEndSpaceAnchorIndexChange,
|
|
5798
5821
|
numColumnsProp
|
|
5799
5822
|
]);
|
|
5800
5823
|
const onLayoutFooter = React2.useCallback(
|
|
@@ -5951,7 +5974,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
5951
5974
|
onScroll: onScrollHandler,
|
|
5952
5975
|
recycleItems,
|
|
5953
5976
|
refreshControl: refreshControlElement ? stylePaddingTopState > 0 ? React2__namespace.cloneElement(refreshControlElement, {
|
|
5954
|
-
progressViewOffset: ((
|
|
5977
|
+
progressViewOffset: ((_h = refreshControlElement.props.progressViewOffset) != null ? _h : 0) + stylePaddingTopState
|
|
5955
5978
|
}) : refreshControlElement : onRefresh && /* @__PURE__ */ React2__namespace.createElement(
|
|
5956
5979
|
ReactNative.RefreshControl,
|
|
5957
5980
|
{
|
|
@@ -5962,7 +5985,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
5962
5985
|
),
|
|
5963
5986
|
refScrollView: combinedRef,
|
|
5964
5987
|
renderScrollComponent,
|
|
5965
|
-
scrollAdjustHandler: (
|
|
5988
|
+
scrollAdjustHandler: (_i = refState.current) == null ? void 0 : _i.scrollAdjustHandler,
|
|
5966
5989
|
scrollEventThrottle: 0,
|
|
5967
5990
|
snapToIndices,
|
|
5968
5991
|
stickyHeaderIndices,
|