@legendapp/list 3.0.0-beta.52 → 3.0.0-beta.54
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 +18 -10
- package/index.d.ts +21 -12
- package/index.js +519 -257
- package/index.mjs +519 -257
- package/index.native.js +439 -250
- package/index.native.mjs +439 -250
- package/keyboard-chat.d.ts +20 -4
- package/keyboard-chat.js +32 -3
- package/keyboard-chat.mjs +33 -5
- package/keyboard-test.d.ts +10 -2
- package/keyboard-test.js +3 -3
- package/keyboard-test.mjs +3 -3
- package/keyboard.d.ts +5 -0
- package/package.json +1 -1
- package/react-native.d.ts +19 -11
- package/react-native.js +439 -250
- package/react-native.mjs +439 -250
- package/react-native.web.d.ts +18 -11
- package/react-native.web.js +519 -257
- package/react-native.web.mjs +519 -257
- package/react.d.ts +18 -11
- package/react.js +519 -257
- package/react.mjs +519 -257
- package/reanimated.d.ts +18 -10
- package/reanimated.js +1 -1
- package/reanimated.mjs +1 -1
- package/section-list.d.ts +18 -10
package/keyboard-chat.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { ScrollViewComponent, ScrollResponderMixin, Insets as Insets$1, ScrollViewProps } from 'react-native';
|
|
2
|
+
import { ScrollViewComponent, ScrollResponderMixin, Insets as Insets$1, ScrollViewProps, View, LayoutChangeEvent } from 'react-native';
|
|
3
3
|
import { KeyboardChatScrollViewProps } from 'react-native-keyboard-controller';
|
|
4
4
|
import { SharedValue } from 'react-native-reanimated';
|
|
5
5
|
import { AnimatedLegendListProps } from '@legendapp/list/reanimated';
|
|
@@ -71,6 +71,10 @@ interface AnchoredEndSpaceConfig$1 {
|
|
|
71
71
|
includeInEndInset?: boolean;
|
|
72
72
|
onSizeChanged?: (size: number) => void;
|
|
73
73
|
}
|
|
74
|
+
interface LegendListAverageItemSize {
|
|
75
|
+
average: number;
|
|
76
|
+
count: number;
|
|
77
|
+
}
|
|
74
78
|
type LegendListState = {
|
|
75
79
|
activeStickyIndex: number;
|
|
76
80
|
contentLength: number;
|
|
@@ -85,6 +89,7 @@ type LegendListState = {
|
|
|
85
89
|
isEndReached: boolean;
|
|
86
90
|
isStartReached: boolean;
|
|
87
91
|
isWithinMaintainScrollAtEndThreshold: boolean;
|
|
92
|
+
getAverageItemSizes: () => Record<string, LegendListAverageItemSize>;
|
|
88
93
|
listen: <T extends LegendListListenerType>(listenerType: T, callback: (value: ListenerTypeValueMap[T]) => void) => () => void;
|
|
89
94
|
listenToPosition: (key: string, callback: (value: number) => void) => () => void;
|
|
90
95
|
positionAtIndex: (index: number) => number;
|
|
@@ -221,7 +226,7 @@ type LegendListRef = Omit<LegendListRef$1, "getNativeScrollRef" | "getScrollResp
|
|
|
221
226
|
reportContentInset(inset?: Partial<Insets$1> | null): void;
|
|
222
227
|
};
|
|
223
228
|
|
|
224
|
-
type KeyboardChatScrollViewPropsUnique = Omit<KeyboardChatScrollViewProps, keyof ScrollViewProps | "inverted" | "ScrollViewComponent" | "blankSpace" | "onContentInsetChange">;
|
|
229
|
+
type KeyboardChatScrollViewPropsUnique = Omit<KeyboardChatScrollViewProps, keyof ScrollViewProps | "inverted" | "ScrollViewComponent" | "blankSpace" | "extraContentPadding" | "onContentInsetChange">;
|
|
225
230
|
type ScrollMessageToEndOptions = {
|
|
226
231
|
animated: boolean;
|
|
227
232
|
closeKeyboard: boolean;
|
|
@@ -237,12 +242,23 @@ type UseKeyboardScrollToEndOptions = {
|
|
|
237
242
|
freeze?: SharedValue<boolean>;
|
|
238
243
|
listRef: KeyboardScrollToEndListRef;
|
|
239
244
|
};
|
|
245
|
+
type KeyboardChatComposerInsetListRef = {
|
|
246
|
+
current: Pick<LegendListRef, "reportContentInset"> | null;
|
|
247
|
+
};
|
|
248
|
+
type KeyboardChatComposerRef = {
|
|
249
|
+
current: Pick<View, "measure"> | null;
|
|
250
|
+
};
|
|
251
|
+
declare function useKeyboardChatComposerInset(listRef: KeyboardChatComposerInsetListRef, composerRef: KeyboardChatComposerRef, initialHeight?: number): {
|
|
252
|
+
contentInsetEndAdjustment: SharedValue<number>;
|
|
253
|
+
onComposerLayout: (event: LayoutChangeEvent) => void;
|
|
254
|
+
};
|
|
240
255
|
declare function useKeyboardScrollToEnd({ freeze: freezeProp, listRef }: UseKeyboardScrollToEndOptions): {
|
|
241
256
|
freeze: SharedValue<boolean>;
|
|
242
257
|
scrollMessageToEnd: ({ animated, closeKeyboard }: ScrollMessageToEndOptions) => Promise<void>;
|
|
243
258
|
};
|
|
244
|
-
declare const KeyboardChatLegendList: <ItemT>(props: Omit<AnimatedLegendListProps<ItemT>, "anchoredEndSpace" | "renderScrollComponent"> & KeyboardChatScrollViewPropsUnique & {
|
|
259
|
+
declare const KeyboardChatLegendList: <ItemT>(props: Omit<AnimatedLegendListProps<ItemT>, "anchoredEndSpace" | "contentInsetEndAdjustment" | "renderScrollComponent"> & KeyboardChatScrollViewPropsUnique & {
|
|
245
260
|
anchoredEndSpace?: AnchoredEndSpaceConfig;
|
|
261
|
+
contentInsetEndAdjustment?: SharedValue<number>;
|
|
246
262
|
} & React.RefAttributes<LegendListRef>) => React.ReactElement | null;
|
|
247
263
|
|
|
248
|
-
export { KeyboardChatLegendList, useKeyboardScrollToEnd };
|
|
264
|
+
export { KeyboardChatLegendList, useKeyboardChatComposerInset, useKeyboardScrollToEnd };
|
package/keyboard-chat.js
CHANGED
|
@@ -28,6 +28,34 @@ var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
|
28
28
|
|
|
29
29
|
// src/integrations/keyboard-chat.tsx
|
|
30
30
|
var { typedForwardRef, useCombinedRef } = reactNative.internal;
|
|
31
|
+
function useKeyboardChatComposerInset(listRef, composerRef, initialHeight = 0) {
|
|
32
|
+
const contentInsetEndAdjustment = reactNativeReanimated.useSharedValue(initialHeight);
|
|
33
|
+
const lastHeightRef = React.useRef(void 0);
|
|
34
|
+
const reportHeight = React.useCallback(
|
|
35
|
+
(height) => {
|
|
36
|
+
var _a;
|
|
37
|
+
if (Number.isFinite(height) && height !== lastHeightRef.current) {
|
|
38
|
+
lastHeightRef.current = height;
|
|
39
|
+
contentInsetEndAdjustment.value = height;
|
|
40
|
+
(_a = listRef.current) == null ? void 0 : _a.reportContentInset({ bottom: height });
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
[contentInsetEndAdjustment, listRef]
|
|
44
|
+
);
|
|
45
|
+
React.useLayoutEffect(() => {
|
|
46
|
+
var _a;
|
|
47
|
+
(_a = composerRef.current) == null ? void 0 : _a.measure((_x, _y, _width, height) => {
|
|
48
|
+
reportHeight(height);
|
|
49
|
+
});
|
|
50
|
+
}, [composerRef, reportHeight]);
|
|
51
|
+
const onComposerLayout = React.useCallback(
|
|
52
|
+
(event) => {
|
|
53
|
+
reportHeight(event.nativeEvent.layout.height);
|
|
54
|
+
},
|
|
55
|
+
[reportHeight]
|
|
56
|
+
);
|
|
57
|
+
return { contentInsetEndAdjustment, onComposerLayout };
|
|
58
|
+
}
|
|
31
59
|
function useKeyboardScrollToEnd({ freeze: freezeProp, listRef }) {
|
|
32
60
|
const internalFreeze = reactNativeReanimated.useSharedValue(false);
|
|
33
61
|
const freeze = freezeProp != null ? freezeProp : internalFreeze;
|
|
@@ -53,7 +81,7 @@ var KeyboardChatLegendList = typedForwardRef(function KeyboardChatLegendList2(pr
|
|
|
53
81
|
const {
|
|
54
82
|
anchoredEndSpace,
|
|
55
83
|
applyWorkaroundForContentInsetHitTestBug,
|
|
56
|
-
|
|
84
|
+
contentInsetEndAdjustment,
|
|
57
85
|
freeze,
|
|
58
86
|
keyboardLiftBehavior,
|
|
59
87
|
offset,
|
|
@@ -93,7 +121,7 @@ var KeyboardChatLegendList = typedForwardRef(function KeyboardChatLegendList2(pr
|
|
|
93
121
|
...scrollProps,
|
|
94
122
|
applyWorkaroundForContentInsetHitTestBug,
|
|
95
123
|
blankSpace,
|
|
96
|
-
extraContentPadding,
|
|
124
|
+
extraContentPadding: contentInsetEndAdjustment,
|
|
97
125
|
keyboardLiftBehavior,
|
|
98
126
|
offset,
|
|
99
127
|
onContentInsetChange
|
|
@@ -103,7 +131,7 @@ var KeyboardChatLegendList = typedForwardRef(function KeyboardChatLegendList2(pr
|
|
|
103
131
|
[
|
|
104
132
|
applyWorkaroundForContentInsetHitTestBug,
|
|
105
133
|
blankSpace,
|
|
106
|
-
|
|
134
|
+
contentInsetEndAdjustment,
|
|
107
135
|
freeze,
|
|
108
136
|
keyboardLiftBehavior,
|
|
109
137
|
onContentInsetChange,
|
|
@@ -123,4 +151,5 @@ var KeyboardChatLegendList = typedForwardRef(function KeyboardChatLegendList2(pr
|
|
|
123
151
|
});
|
|
124
152
|
|
|
125
153
|
exports.KeyboardChatLegendList = KeyboardChatLegendList;
|
|
154
|
+
exports.useKeyboardChatComposerInset = useKeyboardChatComposerInset;
|
|
126
155
|
exports.useKeyboardScrollToEnd = useKeyboardScrollToEnd;
|
package/keyboard-chat.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { useRef, useEffect, useMemo, useCallback } from 'react';
|
|
2
|
+
import { useRef, useEffect, useMemo, useCallback, useLayoutEffect } from 'react';
|
|
3
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';
|
|
@@ -7,6 +7,34 @@ import { AnimatedLegendList } from '@legendapp/list/reanimated';
|
|
|
7
7
|
|
|
8
8
|
// src/integrations/keyboard-chat.tsx
|
|
9
9
|
var { typedForwardRef, useCombinedRef } = internal;
|
|
10
|
+
function useKeyboardChatComposerInset(listRef, composerRef, initialHeight = 0) {
|
|
11
|
+
const contentInsetEndAdjustment = useSharedValue(initialHeight);
|
|
12
|
+
const lastHeightRef = useRef(void 0);
|
|
13
|
+
const reportHeight = useCallback(
|
|
14
|
+
(height) => {
|
|
15
|
+
var _a;
|
|
16
|
+
if (Number.isFinite(height) && height !== lastHeightRef.current) {
|
|
17
|
+
lastHeightRef.current = height;
|
|
18
|
+
contentInsetEndAdjustment.value = height;
|
|
19
|
+
(_a = listRef.current) == null ? void 0 : _a.reportContentInset({ bottom: height });
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
[contentInsetEndAdjustment, listRef]
|
|
23
|
+
);
|
|
24
|
+
useLayoutEffect(() => {
|
|
25
|
+
var _a;
|
|
26
|
+
(_a = composerRef.current) == null ? void 0 : _a.measure((_x, _y, _width, height) => {
|
|
27
|
+
reportHeight(height);
|
|
28
|
+
});
|
|
29
|
+
}, [composerRef, reportHeight]);
|
|
30
|
+
const onComposerLayout = useCallback(
|
|
31
|
+
(event) => {
|
|
32
|
+
reportHeight(event.nativeEvent.layout.height);
|
|
33
|
+
},
|
|
34
|
+
[reportHeight]
|
|
35
|
+
);
|
|
36
|
+
return { contentInsetEndAdjustment, onComposerLayout };
|
|
37
|
+
}
|
|
10
38
|
function useKeyboardScrollToEnd({ freeze: freezeProp, listRef }) {
|
|
11
39
|
const internalFreeze = useSharedValue(false);
|
|
12
40
|
const freeze = freezeProp != null ? freezeProp : internalFreeze;
|
|
@@ -32,7 +60,7 @@ var KeyboardChatLegendList = typedForwardRef(function KeyboardChatLegendList2(pr
|
|
|
32
60
|
const {
|
|
33
61
|
anchoredEndSpace,
|
|
34
62
|
applyWorkaroundForContentInsetHitTestBug,
|
|
35
|
-
|
|
63
|
+
contentInsetEndAdjustment,
|
|
36
64
|
freeze,
|
|
37
65
|
keyboardLiftBehavior,
|
|
38
66
|
offset,
|
|
@@ -72,7 +100,7 @@ var KeyboardChatLegendList = typedForwardRef(function KeyboardChatLegendList2(pr
|
|
|
72
100
|
...scrollProps,
|
|
73
101
|
applyWorkaroundForContentInsetHitTestBug,
|
|
74
102
|
blankSpace,
|
|
75
|
-
extraContentPadding,
|
|
103
|
+
extraContentPadding: contentInsetEndAdjustment,
|
|
76
104
|
keyboardLiftBehavior,
|
|
77
105
|
offset,
|
|
78
106
|
onContentInsetChange
|
|
@@ -82,7 +110,7 @@ var KeyboardChatLegendList = typedForwardRef(function KeyboardChatLegendList2(pr
|
|
|
82
110
|
[
|
|
83
111
|
applyWorkaroundForContentInsetHitTestBug,
|
|
84
112
|
blankSpace,
|
|
85
|
-
|
|
113
|
+
contentInsetEndAdjustment,
|
|
86
114
|
freeze,
|
|
87
115
|
keyboardLiftBehavior,
|
|
88
116
|
onContentInsetChange,
|
|
@@ -101,4 +129,4 @@ var KeyboardChatLegendList = typedForwardRef(function KeyboardChatLegendList2(pr
|
|
|
101
129
|
);
|
|
102
130
|
});
|
|
103
131
|
|
|
104
|
-
export { KeyboardChatLegendList, useKeyboardScrollToEnd };
|
|
132
|
+
export { KeyboardChatLegendList, useKeyboardChatComposerInset, 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
|
+
import { SharedValue } from 'react-native-reanimated';
|
|
4
5
|
export { useKeyboardScrollToEnd } from '@legendapp/list/keyboard-chat';
|
|
5
6
|
import { AnimatedLegendListProps } from '@legendapp/list/reanimated';
|
|
6
7
|
|
|
@@ -64,6 +65,10 @@ interface Insets {
|
|
|
64
65
|
bottom: number;
|
|
65
66
|
right: number;
|
|
66
67
|
}
|
|
68
|
+
interface LegendListAverageItemSize {
|
|
69
|
+
average: number;
|
|
70
|
+
count: number;
|
|
71
|
+
}
|
|
67
72
|
type LegendListState = {
|
|
68
73
|
activeStickyIndex: number;
|
|
69
74
|
contentLength: number;
|
|
@@ -78,6 +83,7 @@ type LegendListState = {
|
|
|
78
83
|
isEndReached: boolean;
|
|
79
84
|
isStartReached: boolean;
|
|
80
85
|
isWithinMaintainScrollAtEndThreshold: boolean;
|
|
86
|
+
getAverageItemSizes: () => Record<string, LegendListAverageItemSize>;
|
|
81
87
|
listen: <T extends LegendListListenerType>(listenerType: T, callback: (value: ListenerTypeValueMap[T]) => void) => () => void;
|
|
82
88
|
listenToPosition: (key: string, callback: (value: number) => void) => () => void;
|
|
83
89
|
positionAtIndex: (index: number) => number;
|
|
@@ -211,7 +217,9 @@ type LegendListRef = Omit<LegendListRef$1, "getNativeScrollRef" | "getScrollResp
|
|
|
211
217
|
reportContentInset(inset?: Partial<Insets$1> | null): void;
|
|
212
218
|
};
|
|
213
219
|
|
|
214
|
-
type KeyboardChatScrollViewPropsUnique = Omit<KeyboardChatScrollViewProps, keyof ScrollViewProps | "inverted" | "ScrollViewComponent" | "onContentInsetChange">;
|
|
215
|
-
declare const KeyboardAvoidingLegendList: <ItemT>(props: Omit<AnimatedLegendListProps<ItemT>, "renderScrollComponent"> & KeyboardChatScrollViewPropsUnique &
|
|
220
|
+
type KeyboardChatScrollViewPropsUnique = Omit<KeyboardChatScrollViewProps, keyof ScrollViewProps | "inverted" | "ScrollViewComponent" | "extraContentPadding" | "onContentInsetChange">;
|
|
221
|
+
declare const KeyboardAvoidingLegendList: <ItemT>(props: Omit<AnimatedLegendListProps<ItemT>, "contentInsetEndAdjustment" | "renderScrollComponent"> & KeyboardChatScrollViewPropsUnique & {
|
|
222
|
+
contentInsetEndAdjustment?: SharedValue<number>;
|
|
223
|
+
} & React.RefAttributes<LegendListRef>) => React.ReactElement | null;
|
|
216
224
|
|
|
217
225
|
export { KeyboardAvoidingLegendList };
|
package/keyboard-test.js
CHANGED
|
@@ -29,7 +29,7 @@ var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
|
29
29
|
// src/integrations/keyboard-test.tsx
|
|
30
30
|
var { typedForwardRef, useCombinedRef } = reactNative.internal;
|
|
31
31
|
var KeyboardAvoidingLegendList = typedForwardRef(function KeyboardAvoidingLegendList2(props, forwardedRef) {
|
|
32
|
-
const {
|
|
32
|
+
const { contentInsetEndAdjustment, ...rest } = props;
|
|
33
33
|
const refLegendList = React.useRef(null);
|
|
34
34
|
const combinedRef = useCombinedRef(forwardedRef, refLegendList);
|
|
35
35
|
const onContentInsetChange = React.useCallback((insets) => {
|
|
@@ -41,11 +41,11 @@ var KeyboardAvoidingLegendList = typedForwardRef(function KeyboardAvoidingLegend
|
|
|
41
41
|
reactNativeKeyboardController.KeyboardChatScrollView,
|
|
42
42
|
{
|
|
43
43
|
...listProps,
|
|
44
|
-
extraContentPadding,
|
|
44
|
+
extraContentPadding: contentInsetEndAdjustment,
|
|
45
45
|
onContentInsetChange
|
|
46
46
|
}
|
|
47
47
|
),
|
|
48
|
-
[
|
|
48
|
+
[contentInsetEndAdjustment, onContentInsetChange]
|
|
49
49
|
);
|
|
50
50
|
return /* @__PURE__ */ React__namespace.createElement(reanimated.AnimatedLegendList, { ref: combinedRef, renderScrollComponent: memoList, ...rest });
|
|
51
51
|
});
|
package/keyboard-test.mjs
CHANGED
|
@@ -8,7 +8,7 @@ import { AnimatedLegendList } from '@legendapp/list/reanimated';
|
|
|
8
8
|
// src/integrations/keyboard-test.tsx
|
|
9
9
|
var { typedForwardRef, useCombinedRef } = internal;
|
|
10
10
|
var KeyboardAvoidingLegendList = typedForwardRef(function KeyboardAvoidingLegendList2(props, forwardedRef) {
|
|
11
|
-
const {
|
|
11
|
+
const { contentInsetEndAdjustment, ...rest } = props;
|
|
12
12
|
const refLegendList = useRef(null);
|
|
13
13
|
const combinedRef = useCombinedRef(forwardedRef, refLegendList);
|
|
14
14
|
const onContentInsetChange = useCallback((insets) => {
|
|
@@ -20,11 +20,11 @@ var KeyboardAvoidingLegendList = typedForwardRef(function KeyboardAvoidingLegend
|
|
|
20
20
|
KeyboardChatScrollView,
|
|
21
21
|
{
|
|
22
22
|
...listProps,
|
|
23
|
-
extraContentPadding,
|
|
23
|
+
extraContentPadding: contentInsetEndAdjustment,
|
|
24
24
|
onContentInsetChange
|
|
25
25
|
}
|
|
26
26
|
),
|
|
27
|
-
[
|
|
27
|
+
[contentInsetEndAdjustment, onContentInsetChange]
|
|
28
28
|
);
|
|
29
29
|
return /* @__PURE__ */ React.createElement(AnimatedLegendList, { ref: combinedRef, renderScrollComponent: memoList, ...rest });
|
|
30
30
|
});
|
package/keyboard.d.ts
CHANGED
|
@@ -63,6 +63,10 @@ interface Insets {
|
|
|
63
63
|
bottom: number;
|
|
64
64
|
right: number;
|
|
65
65
|
}
|
|
66
|
+
interface LegendListAverageItemSize {
|
|
67
|
+
average: number;
|
|
68
|
+
count: number;
|
|
69
|
+
}
|
|
66
70
|
type LegendListState = {
|
|
67
71
|
activeStickyIndex: number;
|
|
68
72
|
contentLength: number;
|
|
@@ -77,6 +81,7 @@ type LegendListState = {
|
|
|
77
81
|
isEndReached: boolean;
|
|
78
82
|
isStartReached: boolean;
|
|
79
83
|
isWithinMaintainScrollAtEndThreshold: boolean;
|
|
84
|
+
getAverageItemSizes: () => Record<string, LegendListAverageItemSize>;
|
|
80
85
|
listen: <T extends LegendListListenerType>(listenerType: T, callback: (value: ListenerTypeValueMap[T]) => void) => () => void;
|
|
81
86
|
listenToPosition: (key: string, callback: (value: number) => void) => () => void;
|
|
82
87
|
positionAtIndex: (index: number) => number;
|
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.54",
|
|
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.d.ts
CHANGED
|
@@ -160,7 +160,10 @@ interface LegendListSpecificProps<ItemT, TItemType extends string | undefined> {
|
|
|
160
160
|
*/
|
|
161
161
|
extraData?: any;
|
|
162
162
|
/**
|
|
163
|
-
*
|
|
163
|
+
* Optional per-item size estimate used before a row is measured.
|
|
164
|
+
*
|
|
165
|
+
* @deprecated Prefer a single `estimatedItemSize` for initial size hints, or `getFixedItemSize`
|
|
166
|
+
* when item sizes are known exactly.
|
|
164
167
|
*/
|
|
165
168
|
getEstimatedItemSize?: (item: ItemT, index: number, type: TItemType) => number;
|
|
166
169
|
/**
|
|
@@ -178,8 +181,9 @@ interface LegendListSpecificProps<ItemT, TItemType extends string | undefined> {
|
|
|
178
181
|
leadingItem: ItemT;
|
|
179
182
|
}>;
|
|
180
183
|
/**
|
|
181
|
-
* Ratio
|
|
182
|
-
* @
|
|
184
|
+
* Ratio used to size the initial recycled container pool.
|
|
185
|
+
* @deprecated The list now manages spare container capacity automatically.
|
|
186
|
+
* @default 3
|
|
183
187
|
*/
|
|
184
188
|
initialContainerPoolRatio?: number | undefined;
|
|
185
189
|
/**
|
|
@@ -254,6 +258,11 @@ interface LegendListSpecificProps<ItemT, TItemType extends string | undefined> {
|
|
|
254
258
|
* Keeps an item visually anchored to the start by adding trailing space when the content below it underflows.
|
|
255
259
|
*/
|
|
256
260
|
anchoredEndSpace?: AnchoredEndSpaceConfig;
|
|
261
|
+
/**
|
|
262
|
+
* Adjusts the effective end content inset for web lists without replacing the base contentInset.
|
|
263
|
+
* The adjustment is also rendered as real content padding so the browser scroll range includes it.
|
|
264
|
+
*/
|
|
265
|
+
contentInsetEndAdjustment?: number;
|
|
257
266
|
/**
|
|
258
267
|
* Number of columns to render items in.
|
|
259
268
|
* @default 1
|
|
@@ -355,12 +364,6 @@ interface LegendListSpecificProps<ItemT, TItemType extends string | undefined> {
|
|
|
355
364
|
* Array of item indices to use as snap points.
|
|
356
365
|
*/
|
|
357
366
|
snapToIndices?: number[];
|
|
358
|
-
/**
|
|
359
|
-
* This will log a suggested estimatedItemSize.
|
|
360
|
-
* @required
|
|
361
|
-
* @default false
|
|
362
|
-
*/
|
|
363
|
-
suggestEstimatedItemSize?: boolean;
|
|
364
367
|
/**
|
|
365
368
|
* Configuration for determining item viewability.
|
|
366
369
|
*/
|
|
@@ -449,6 +452,10 @@ interface LegendListMetrics {
|
|
|
449
452
|
headerSize: number;
|
|
450
453
|
footerSize: number;
|
|
451
454
|
}
|
|
455
|
+
interface LegendListAverageItemSize {
|
|
456
|
+
average: number;
|
|
457
|
+
count: number;
|
|
458
|
+
}
|
|
452
459
|
interface LegendListRenderItemProps<ItemT, TItemType extends string | number | undefined = string | number | undefined> {
|
|
453
460
|
data: readonly ItemT[];
|
|
454
461
|
extraData: any;
|
|
@@ -470,6 +477,7 @@ type LegendListState$1 = {
|
|
|
470
477
|
isEndReached: boolean;
|
|
471
478
|
isStartReached: boolean;
|
|
472
479
|
isWithinMaintainScrollAtEndThreshold: boolean;
|
|
480
|
+
getAverageItemSizes: () => Record<string, LegendListAverageItemSize>;
|
|
473
481
|
listen: <T extends LegendListListenerType>(listenerType: T, callback: (value: ListenerTypeValueMap[T]) => void) => () => void;
|
|
474
482
|
listenToPosition: (key: string, callback: (value: number) => void) => () => void;
|
|
475
483
|
positionAtIndex: (index: number) => number;
|
|
@@ -679,7 +687,7 @@ interface InitialScrollAnchor extends ScrollIndexWithOffsetPosition {
|
|
|
679
687
|
settledTicks?: number;
|
|
680
688
|
}
|
|
681
689
|
|
|
682
|
-
type LegendListPropsOverrides<ItemT, TItemType extends string | undefined> = Omit<LegendListPropsBase<ItemT, ScrollViewProps, TItemType>, "anchoredEndSpace" | "onScroll" | "refScrollView" | "renderScrollComponent" | "ListHeaderComponentStyle" | "ListFooterComponentStyle"> & {
|
|
690
|
+
type LegendListPropsOverrides<ItemT, TItemType extends string | undefined> = Omit<LegendListPropsBase<ItemT, ScrollViewProps, TItemType>, "anchoredEndSpace" | "contentInsetEndAdjustment" | "onScroll" | "refScrollView" | "renderScrollComponent" | "ListHeaderComponentStyle" | "ListFooterComponentStyle"> & {
|
|
683
691
|
onScroll?: (event: NativeSyntheticEvent$1<NativeScrollEvent$1>) => void;
|
|
684
692
|
refScrollView?: React.Ref<ScrollView>;
|
|
685
693
|
renderScrollComponent?: (props: ScrollViewProps) => React.ReactElement<ScrollViewProps>;
|
|
@@ -710,4 +718,4 @@ declare function useSyncLayout(): () => void;
|
|
|
710
718
|
|
|
711
719
|
declare const LegendList: LegendListComponent;
|
|
712
720
|
|
|
713
|
-
export { type AlwaysRenderConfig, type ColumnWrapperStyle, type InitialScrollAnchor, type Insets, type LayoutRectangle, LegendList, type LegendListComponent, type LegendListMetrics, type LegendListProps, type LegendListRecyclingState, type LegendListRef, type LegendListRenderItemProps, type LegendListState, type MaintainScrollAtEndOnOptions, type MaintainScrollAtEndOptions, type MaintainVisibleContentPositionConfig, type NativeScrollEvent, type NativeSyntheticEvent, type OnViewableItemsChanged, type OnViewableItemsChangedInfo, type ScrollIndexWithOffset, type ScrollIndexWithOffsetAndContentOffset, type ScrollIndexWithOffsetPosition, type StickyHeaderConfig, type StyleProp, type ViewAmountToken, type ViewStyle, type ViewToken, type ViewabilityAmountCallback, type ViewabilityCallback, type ViewabilityConfig, type ViewabilityConfigCallbackPair, type ViewabilityConfigCallbackPairs, useIsLastItem, useListScrollSize, useRecyclingEffect, useRecyclingState, useSyncLayout, useViewability, useViewabilityAmount };
|
|
721
|
+
export { type AlwaysRenderConfig, type ColumnWrapperStyle, type InitialScrollAnchor, type Insets, type LayoutRectangle, LegendList, type LegendListAverageItemSize, type LegendListComponent, type LegendListMetrics, type LegendListProps, type LegendListRecyclingState, type LegendListRef, type LegendListRenderItemProps, type LegendListState, type MaintainScrollAtEndOnOptions, type MaintainScrollAtEndOptions, type MaintainVisibleContentPositionConfig, type NativeScrollEvent, type NativeSyntheticEvent, type OnViewableItemsChanged, type OnViewableItemsChangedInfo, type ScrollIndexWithOffset, type ScrollIndexWithOffsetAndContentOffset, type ScrollIndexWithOffsetPosition, type StickyHeaderConfig, type StyleProp, type ViewAmountToken, type ViewStyle, type ViewToken, type ViewabilityAmountCallback, type ViewabilityCallback, type ViewabilityConfig, type ViewabilityConfigCallbackPair, type ViewabilityConfigCallbackPairs, useIsLastItem, useListScrollSize, useRecyclingEffect, useRecyclingState, useSyncLayout, useViewability, useViewabilityAmount };
|