@legendapp/list 3.0.0-beta.8 → 3.0.0

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.
Files changed (49) hide show
  1. package/.DS_Store +0 -0
  2. package/CHANGELOG.md +21 -1
  3. package/README.md +8 -2
  4. package/animated.d.ts +659 -5
  5. package/animated.js +2 -2
  6. package/animated.mjs +1 -1
  7. package/keyboard-legacy.d.ts +226 -0
  8. package/keyboard-legacy.js +456 -0
  9. package/keyboard-legacy.mjs +435 -0
  10. package/keyboard.d.ts +261 -9
  11. package/keyboard.js +114 -135
  12. package/keyboard.mjs +115 -137
  13. package/package.json +55 -5
  14. package/{types-DjNeqVEk.d.mts → react-native.d.ts} +318 -278
  15. package/react-native.js +6453 -0
  16. package/react-native.mjs +6424 -0
  17. package/react-native.web.d.ts +771 -0
  18. package/react-native.web.js +7111 -0
  19. package/react-native.web.mjs +7082 -0
  20. package/react.d.ts +771 -0
  21. package/react.js +7111 -0
  22. package/react.mjs +7082 -0
  23. package/reanimated.d.ts +681 -8
  24. package/reanimated.js +225 -29
  25. package/reanimated.mjs +227 -31
  26. package/section-list.d.ts +663 -5
  27. package/section-list.js +39 -3720
  28. package/section-list.mjs +37 -3719
  29. package/animated.d.mts +0 -9
  30. package/index.d.mts +0 -23
  31. package/index.d.ts +0 -23
  32. package/index.js +0 -3826
  33. package/index.mjs +0 -3798
  34. package/index.native.d.mts +0 -23
  35. package/index.native.d.ts +0 -23
  36. package/index.native.js +0 -3580
  37. package/index.native.mjs +0 -3552
  38. package/keyboard-controller.d.mts +0 -12
  39. package/keyboard-controller.d.ts +0 -12
  40. package/keyboard-controller.js +0 -69
  41. package/keyboard-controller.mjs +0 -48
  42. package/keyboard.d.mts +0 -13
  43. package/reanimated.d.mts +0 -18
  44. package/section-list.d.mts +0 -113
  45. package/section-list.native.d.mts +0 -113
  46. package/section-list.native.d.ts +0 -113
  47. package/section-list.native.js +0 -3738
  48. package/section-list.native.mjs +0 -3717
  49. package/types-DjNeqVEk.d.ts +0 -669
@@ -1,12 +0,0 @@
1
- import * as React from 'react';
2
- import { LegendList as LegendList$1, LegendListProps, LegendListRef } from '@legendapp/list';
3
- import { AnimatedLegendList } from '@legendapp/list/animated';
4
- import { AnimatedLegendList as AnimatedLegendList$1 } from '@legendapp/list/reanimated';
5
-
6
- declare const LegendList: <ItemT, ListT extends typeof LegendList$1 | typeof AnimatedLegendList | typeof AnimatedLegendList$1 = (<T>(props: LegendListProps<T> & React.RefAttributes<LegendListRef>) => React.ReactNode) & {
7
- displayName?: string;
8
- }>(props: (LegendListProps<ItemT> & {
9
- LegendList?: ListT;
10
- }) & React.RefAttributes<LegendListRef>) => React.ReactNode;
11
-
12
- export { LegendList };
@@ -1,12 +0,0 @@
1
- import * as React from 'react';
2
- import { LegendList as LegendList$1, LegendListProps, LegendListRef } from '@legendapp/list';
3
- import { AnimatedLegendList } from '@legendapp/list/animated';
4
- import { AnimatedLegendList as AnimatedLegendList$1 } from '@legendapp/list/reanimated';
5
-
6
- declare const LegendList: <ItemT, ListT extends typeof LegendList$1 | typeof AnimatedLegendList | typeof AnimatedLegendList$1 = (<T>(props: LegendListProps<T> & React.RefAttributes<LegendListRef>) => React.ReactNode) & {
7
- displayName?: string;
8
- }>(props: (LegendListProps<ItemT> & {
9
- LegendList?: ListT;
10
- }) & React.RefAttributes<LegendListRef>) => React.ReactNode;
11
-
12
- export { LegendList };
@@ -1,69 +0,0 @@
1
- 'use strict';
2
-
3
- var React = require('react');
4
- var reactNative = require('react-native');
5
- var reactNativeKeyboardController = require('react-native-keyboard-controller');
6
- var reactNativeReanimated = require('react-native-reanimated');
7
- var list = require('@legendapp/list');
8
-
9
- function _interopNamespace(e) {
10
- if (e && e.__esModule) return e;
11
- var n = Object.create(null);
12
- if (e) {
13
- Object.keys(e).forEach(function (k) {
14
- if (k !== 'default') {
15
- var d = Object.getOwnPropertyDescriptor(e, k);
16
- Object.defineProperty(n, k, d.get ? d : {
17
- enumerable: true,
18
- get: function () { return e[k]; }
19
- });
20
- }
21
- });
22
- }
23
- n.default = e;
24
- return Object.freeze(n);
25
- }
26
-
27
- var React__namespace = /*#__PURE__*/_interopNamespace(React);
28
-
29
- // src/integrations/keyboard-controller.tsx
30
- var typedForwardRef = React.forwardRef;
31
- var LegendList = typedForwardRef(function LegendList2(props, forwardedRef) {
32
- const {
33
- LegendList: LegendListProp,
34
- contentContainerStyle: contentContainerStyleProp,
35
- scrollIndicatorInsets: scrollIndicatorInsetsProp,
36
- ...rest
37
- } = props;
38
- const [padding, setPadding] = React.useState(0);
39
- const updatePadding = (height) => {
40
- setPadding(height);
41
- };
42
- reactNativeKeyboardController.useKeyboardHandler({
43
- onEnd: (e) => {
44
- "worklet";
45
- reactNativeReanimated.runOnJS(updatePadding)(e.height);
46
- }
47
- });
48
- const LegendListComponent = LegendListProp != null ? LegendListProp : list.LegendList;
49
- const contentContainerStyleFlattened = reactNative.StyleSheet.flatten(contentContainerStyleProp) || {};
50
- const contentContainerStyle = { ...contentContainerStyleFlattened, paddingTop: padding };
51
- const scrollIndicatorInsets = scrollIndicatorInsetsProp ? { ...scrollIndicatorInsetsProp } : {};
52
- if (!props.horizontal) {
53
- scrollIndicatorInsets.top = ((scrollIndicatorInsets == null ? void 0 : scrollIndicatorInsets.top) || 0) + padding;
54
- }
55
- return (
56
- // @ts-expect-error TODO: Fix this type
57
- /* @__PURE__ */ React__namespace.createElement(
58
- LegendListComponent,
59
- {
60
- ...rest,
61
- contentContainerStyle,
62
- ref: forwardedRef,
63
- scrollIndicatorInsets
64
- }
65
- )
66
- );
67
- });
68
-
69
- exports.LegendList = LegendList;
@@ -1,48 +0,0 @@
1
- import * as React from 'react';
2
- import { useState, forwardRef } from 'react';
3
- import { StyleSheet } from 'react-native';
4
- import { useKeyboardHandler } from 'react-native-keyboard-controller';
5
- import { runOnJS } from 'react-native-reanimated';
6
- import { LegendList as LegendList$1 } from '@legendapp/list';
7
-
8
- // src/integrations/keyboard-controller.tsx
9
- var typedForwardRef = forwardRef;
10
- var LegendList = typedForwardRef(function LegendList2(props, forwardedRef) {
11
- const {
12
- LegendList: LegendListProp,
13
- contentContainerStyle: contentContainerStyleProp,
14
- scrollIndicatorInsets: scrollIndicatorInsetsProp,
15
- ...rest
16
- } = props;
17
- const [padding, setPadding] = useState(0);
18
- const updatePadding = (height) => {
19
- setPadding(height);
20
- };
21
- useKeyboardHandler({
22
- onEnd: (e) => {
23
- "worklet";
24
- runOnJS(updatePadding)(e.height);
25
- }
26
- });
27
- const LegendListComponent = LegendListProp != null ? LegendListProp : LegendList$1;
28
- const contentContainerStyleFlattened = StyleSheet.flatten(contentContainerStyleProp) || {};
29
- const contentContainerStyle = { ...contentContainerStyleFlattened, paddingTop: padding };
30
- const scrollIndicatorInsets = scrollIndicatorInsetsProp ? { ...scrollIndicatorInsetsProp } : {};
31
- if (!props.horizontal) {
32
- scrollIndicatorInsets.top = ((scrollIndicatorInsets == null ? void 0 : scrollIndicatorInsets.top) || 0) + padding;
33
- }
34
- return (
35
- // @ts-expect-error TODO: Fix this type
36
- /* @__PURE__ */ React.createElement(
37
- LegendListComponent,
38
- {
39
- ...rest,
40
- contentContainerStyle,
41
- ref: forwardedRef,
42
- scrollIndicatorInsets
43
- }
44
- )
45
- );
46
- });
47
-
48
- export { LegendList };
package/keyboard.d.mts DELETED
@@ -1,13 +0,0 @@
1
- import * as React from 'react';
2
- import { Insets } from 'react-native';
3
- import { ReanimatedScrollEvent } from 'react-native-reanimated/lib/typescript/hook/commonTypes';
4
- import { LegendListRef } from '@legendapp/list';
5
- import { AnimatedLegendListProps } from '@legendapp/list/reanimated';
6
-
7
- declare const KeyboardAvoidingLegendList: <ItemT>(props: Omit<AnimatedLegendListProps<ItemT>, "onScroll" | "contentInset"> & {
8
- onScroll?: (event: ReanimatedScrollEvent) => void;
9
- contentInset?: Insets;
10
- safeAreaInsetBottom?: number;
11
- } & React.RefAttributes<LegendListRef>) => React.ReactNode;
12
-
13
- export { KeyboardAvoidingLegendList, KeyboardAvoidingLegendList as LegendList };
package/reanimated.d.mts DELETED
@@ -1,18 +0,0 @@
1
- import * as React from 'react';
2
- import { ComponentProps } from 'react';
3
- import Reanimated from 'react-native-reanimated';
4
- import { LegendListPropsBase, LegendListRef } from '@legendapp/list';
5
-
6
- type KeysToOmit = "getEstimatedItemSize" | "getFixedItemSize" | "getItemType" | "keyExtractor" | "animatedProps" | "renderItem" | "onItemSizeChanged" | "itemsAreEqual" | "ItemSeparatorComponent";
7
- type PropsBase<ItemT> = LegendListPropsBase<ItemT, ComponentProps<typeof Reanimated.ScrollView>>;
8
- interface AnimatedLegendListPropsBase<ItemT> extends Omit<PropsBase<ItemT>, KeysToOmit> {
9
- refScrollView?: React.Ref<Reanimated.ScrollView>;
10
- }
11
- type OtherAnimatedLegendListProps<ItemT> = Pick<PropsBase<ItemT>, KeysToOmit>;
12
- type AnimatedLegendListProps<ItemT> = Omit<AnimatedLegendListPropsBase<ItemT>, "refLegendList" | "ref"> & OtherAnimatedLegendListProps<ItemT>;
13
- type AnimatedLegendListDefinition = <ItemT>(props: AnimatedLegendListProps<ItemT> & {
14
- ref?: React.Ref<LegendListRef>;
15
- }) => React.ReactElement | null;
16
- declare const AnimatedLegendList: AnimatedLegendListDefinition;
17
-
18
- export { AnimatedLegendList, type AnimatedLegendListProps, type AnimatedLegendListPropsBase };
@@ -1,113 +0,0 @@
1
- import * as react_native from 'react-native';
2
- import { SectionListData, SectionBase, SectionListRenderItemInfo, SectionListScrollParams } from 'react-native';
3
- import * as React from 'react';
4
- import { a as LegendListRef, L as LegendListProps } from './types-DjNeqVEk.mjs';
5
- import 'react-native-reanimated';
6
-
7
- type SectionListSeparatorProps<ItemT, SectionT> = {
8
- leadingItem?: ItemT;
9
- leadingSection?: SectionListData<ItemT, SectionT>;
10
- section: SectionListData<ItemT, SectionT>;
11
- trailingItem?: ItemT;
12
- trailingSection?: SectionListData<ItemT, SectionT>;
13
- };
14
- type SectionHeaderItem<SectionT> = {
15
- kind: "header";
16
- key: string;
17
- section: SectionT;
18
- sectionIndex: number;
19
- };
20
- type SectionFooterItem<SectionT> = {
21
- kind: "footer";
22
- key: string;
23
- section: SectionT;
24
- sectionIndex: number;
25
- };
26
- type SectionBodyItem<ItemT, SectionT> = {
27
- kind: "item";
28
- key: string;
29
- section: SectionT;
30
- sectionIndex: number;
31
- item: ItemT;
32
- itemIndex: number;
33
- absoluteItemIndex: number;
34
- };
35
- type SectionItemSeparator<ItemT, SectionT> = {
36
- kind: "item-separator";
37
- key: string;
38
- section: SectionT;
39
- sectionIndex: number;
40
- leadingItem: ItemT;
41
- leadingItemIndex: number;
42
- trailingItem?: ItemT;
43
- };
44
- type SectionSeparator<SectionT> = {
45
- kind: "section-separator";
46
- key: string;
47
- leadingSection: SectionT;
48
- leadingSectionIndex: number;
49
- trailingSection?: SectionT;
50
- };
51
- type FlatSectionListItem<ItemT, SectionT> = SectionHeaderItem<SectionT> | SectionFooterItem<SectionT> | SectionBodyItem<ItemT, SectionT> | SectionItemSeparator<ItemT, SectionT> | SectionSeparator<SectionT>;
52
- type SectionMeta = {
53
- header?: number;
54
- footer?: number;
55
- items: number[];
56
- };
57
- type BuildSectionListDataResult<ItemT, SectionT> = {
58
- data: Array<FlatSectionListItem<ItemT, SectionT>>;
59
- sectionMeta: SectionMeta[];
60
- stickyHeaderIndices: number[];
61
- };
62
-
63
- type SectionListViewToken<ItemT, SectionT> = {
64
- item: ItemT;
65
- key: string;
66
- index: number;
67
- isViewable: boolean;
68
- section: SectionListData<ItemT, SectionT>;
69
- };
70
- type SectionListOnViewableItemsChanged<ItemT, SectionT> = ((info: {
71
- viewableItems: Array<SectionListViewToken<ItemT, SectionT>>;
72
- changed: Array<SectionListViewToken<ItemT, SectionT>>;
73
- }) => void) | null;
74
- type SectionListLegendProps<ItemT, SectionT> = Omit<LegendListProps<FlatSectionListItem<ItemT, SectionT>>, "data" | "children" | "renderItem" | "keyExtractor" | "ItemSeparatorComponent" | "getItemType" | "getFixedItemSize" | "stickyHeaderIndices" | "numColumns" | "columnWrapperStyle" | "onViewableItemsChanged">;
75
- type SectionListProps<ItemT, SectionT extends SectionBase<ItemT> = SectionBase<ItemT>> = SectionListLegendProps<ItemT, SectionT> & {
76
- sections: ReadonlyArray<SectionListData<ItemT, SectionT>>;
77
- extraData?: any;
78
- renderItem?: (info: SectionListRenderItemInfo<ItemT, SectionT>) => React.ReactElement | null;
79
- renderSectionHeader?: (info: {
80
- section: SectionListData<ItemT, SectionT>;
81
- }) => React.ReactElement | null;
82
- renderSectionFooter?: (info: {
83
- section: SectionListData<ItemT, SectionT>;
84
- }) => React.ReactElement | null;
85
- ItemSeparatorComponent?: React.ComponentType<SectionListSeparatorProps<ItemT, SectionT>> | null;
86
- SectionSeparatorComponent?: React.ComponentType<SectionListSeparatorProps<ItemT, SectionT>> | React.ReactElement | null;
87
- keyExtractor?: (item: ItemT, index: number) => string;
88
- stickySectionHeadersEnabled?: boolean;
89
- onViewableItemsChanged?: SectionListOnViewableItemsChanged<ItemT, SectionT>;
90
- };
91
- type SectionListRef = LegendListRef & {
92
- scrollToLocation(params: SectionListScrollParams): void;
93
- };
94
- declare const SectionList: (<ItemT, SectionT extends SectionBase<ItemT, react_native.DefaultSectionT>>(props: SectionListLegendProps<ItemT, SectionT> & {
95
- sections: readonly SectionListData<ItemT, SectionT>[];
96
- extraData?: any;
97
- renderItem?: ((info: SectionListRenderItemInfo<ItemT, SectionT>) => React.ReactElement | null) | undefined;
98
- renderSectionHeader?: ((info: {
99
- section: SectionListData<ItemT, SectionT>;
100
- }) => React.ReactElement | null) | undefined;
101
- renderSectionFooter?: ((info: {
102
- section: SectionListData<ItemT, SectionT>;
103
- }) => React.ReactElement | null) | undefined;
104
- ItemSeparatorComponent?: React.ComponentType<SectionListSeparatorProps<ItemT, SectionT>> | null | undefined;
105
- SectionSeparatorComponent?: React.ReactElement<any, string | React.JSXElementConstructor<any>> | React.ComponentType<SectionListSeparatorProps<ItemT, SectionT>> | null | undefined;
106
- keyExtractor?: ((item: ItemT, index: number) => string) | undefined;
107
- stickySectionHeadersEnabled?: boolean;
108
- onViewableItemsChanged?: SectionListOnViewableItemsChanged<ItemT, SectionT> | undefined;
109
- } & React.RefAttributes<SectionListRef>) => React.ReactNode) & {
110
- displayName?: string;
111
- };
112
-
113
- export { type BuildSectionListDataResult, type FlatSectionListItem, SectionList, type SectionListOnViewableItemsChanged, type SectionListProps, type SectionListRef, type SectionListSeparatorProps, type SectionListViewToken, type SectionMeta };
@@ -1,113 +0,0 @@
1
- import * as react_native from 'react-native';
2
- import { SectionListData, SectionBase, SectionListRenderItemInfo, SectionListScrollParams } from 'react-native';
3
- import * as React from 'react';
4
- import { a as LegendListRef, L as LegendListProps } from './types-DjNeqVEk.mjs';
5
- import 'react-native-reanimated';
6
-
7
- type SectionListSeparatorProps<ItemT, SectionT> = {
8
- leadingItem?: ItemT;
9
- leadingSection?: SectionListData<ItemT, SectionT>;
10
- section: SectionListData<ItemT, SectionT>;
11
- trailingItem?: ItemT;
12
- trailingSection?: SectionListData<ItemT, SectionT>;
13
- };
14
- type SectionHeaderItem<SectionT> = {
15
- kind: "header";
16
- key: string;
17
- section: SectionT;
18
- sectionIndex: number;
19
- };
20
- type SectionFooterItem<SectionT> = {
21
- kind: "footer";
22
- key: string;
23
- section: SectionT;
24
- sectionIndex: number;
25
- };
26
- type SectionBodyItem<ItemT, SectionT> = {
27
- kind: "item";
28
- key: string;
29
- section: SectionT;
30
- sectionIndex: number;
31
- item: ItemT;
32
- itemIndex: number;
33
- absoluteItemIndex: number;
34
- };
35
- type SectionItemSeparator<ItemT, SectionT> = {
36
- kind: "item-separator";
37
- key: string;
38
- section: SectionT;
39
- sectionIndex: number;
40
- leadingItem: ItemT;
41
- leadingItemIndex: number;
42
- trailingItem?: ItemT;
43
- };
44
- type SectionSeparator<SectionT> = {
45
- kind: "section-separator";
46
- key: string;
47
- leadingSection: SectionT;
48
- leadingSectionIndex: number;
49
- trailingSection?: SectionT;
50
- };
51
- type FlatSectionListItem<ItemT, SectionT> = SectionHeaderItem<SectionT> | SectionFooterItem<SectionT> | SectionBodyItem<ItemT, SectionT> | SectionItemSeparator<ItemT, SectionT> | SectionSeparator<SectionT>;
52
- type SectionMeta = {
53
- header?: number;
54
- footer?: number;
55
- items: number[];
56
- };
57
- type BuildSectionListDataResult<ItemT, SectionT> = {
58
- data: Array<FlatSectionListItem<ItemT, SectionT>>;
59
- sectionMeta: SectionMeta[];
60
- stickyHeaderIndices: number[];
61
- };
62
-
63
- type SectionListViewToken<ItemT, SectionT> = {
64
- item: ItemT;
65
- key: string;
66
- index: number;
67
- isViewable: boolean;
68
- section: SectionListData<ItemT, SectionT>;
69
- };
70
- type SectionListOnViewableItemsChanged<ItemT, SectionT> = ((info: {
71
- viewableItems: Array<SectionListViewToken<ItemT, SectionT>>;
72
- changed: Array<SectionListViewToken<ItemT, SectionT>>;
73
- }) => void) | null;
74
- type SectionListLegendProps<ItemT, SectionT> = Omit<LegendListProps<FlatSectionListItem<ItemT, SectionT>>, "data" | "children" | "renderItem" | "keyExtractor" | "ItemSeparatorComponent" | "getItemType" | "getFixedItemSize" | "stickyHeaderIndices" | "numColumns" | "columnWrapperStyle" | "onViewableItemsChanged">;
75
- type SectionListProps<ItemT, SectionT extends SectionBase<ItemT> = SectionBase<ItemT>> = SectionListLegendProps<ItemT, SectionT> & {
76
- sections: ReadonlyArray<SectionListData<ItemT, SectionT>>;
77
- extraData?: any;
78
- renderItem?: (info: SectionListRenderItemInfo<ItemT, SectionT>) => React.ReactElement | null;
79
- renderSectionHeader?: (info: {
80
- section: SectionListData<ItemT, SectionT>;
81
- }) => React.ReactElement | null;
82
- renderSectionFooter?: (info: {
83
- section: SectionListData<ItemT, SectionT>;
84
- }) => React.ReactElement | null;
85
- ItemSeparatorComponent?: React.ComponentType<SectionListSeparatorProps<ItemT, SectionT>> | null;
86
- SectionSeparatorComponent?: React.ComponentType<SectionListSeparatorProps<ItemT, SectionT>> | React.ReactElement | null;
87
- keyExtractor?: (item: ItemT, index: number) => string;
88
- stickySectionHeadersEnabled?: boolean;
89
- onViewableItemsChanged?: SectionListOnViewableItemsChanged<ItemT, SectionT>;
90
- };
91
- type SectionListRef = LegendListRef & {
92
- scrollToLocation(params: SectionListScrollParams): void;
93
- };
94
- declare const SectionList: (<ItemT, SectionT extends SectionBase<ItemT, react_native.DefaultSectionT>>(props: SectionListLegendProps<ItemT, SectionT> & {
95
- sections: readonly SectionListData<ItemT, SectionT>[];
96
- extraData?: any;
97
- renderItem?: ((info: SectionListRenderItemInfo<ItemT, SectionT>) => React.ReactElement | null) | undefined;
98
- renderSectionHeader?: ((info: {
99
- section: SectionListData<ItemT, SectionT>;
100
- }) => React.ReactElement | null) | undefined;
101
- renderSectionFooter?: ((info: {
102
- section: SectionListData<ItemT, SectionT>;
103
- }) => React.ReactElement | null) | undefined;
104
- ItemSeparatorComponent?: React.ComponentType<SectionListSeparatorProps<ItemT, SectionT>> | null | undefined;
105
- SectionSeparatorComponent?: React.ReactElement<any, string | React.JSXElementConstructor<any>> | React.ComponentType<SectionListSeparatorProps<ItemT, SectionT>> | null | undefined;
106
- keyExtractor?: ((item: ItemT, index: number) => string) | undefined;
107
- stickySectionHeadersEnabled?: boolean;
108
- onViewableItemsChanged?: SectionListOnViewableItemsChanged<ItemT, SectionT> | undefined;
109
- } & React.RefAttributes<SectionListRef>) => React.ReactNode) & {
110
- displayName?: string;
111
- };
112
-
113
- export { type BuildSectionListDataResult, type FlatSectionListItem, SectionList, type SectionListOnViewableItemsChanged, type SectionListProps, type SectionListRef, type SectionListSeparatorProps, type SectionListViewToken, type SectionMeta };
@@ -1,113 +0,0 @@
1
- import * as react_native from 'react-native';
2
- import { SectionListData, SectionBase, SectionListRenderItemInfo, SectionListScrollParams } from 'react-native';
3
- import * as React from 'react';
4
- import { a as LegendListRef, L as LegendListProps } from './types-DjNeqVEk.js';
5
- import 'react-native-reanimated';
6
-
7
- type SectionListSeparatorProps<ItemT, SectionT> = {
8
- leadingItem?: ItemT;
9
- leadingSection?: SectionListData<ItemT, SectionT>;
10
- section: SectionListData<ItemT, SectionT>;
11
- trailingItem?: ItemT;
12
- trailingSection?: SectionListData<ItemT, SectionT>;
13
- };
14
- type SectionHeaderItem<SectionT> = {
15
- kind: "header";
16
- key: string;
17
- section: SectionT;
18
- sectionIndex: number;
19
- };
20
- type SectionFooterItem<SectionT> = {
21
- kind: "footer";
22
- key: string;
23
- section: SectionT;
24
- sectionIndex: number;
25
- };
26
- type SectionBodyItem<ItemT, SectionT> = {
27
- kind: "item";
28
- key: string;
29
- section: SectionT;
30
- sectionIndex: number;
31
- item: ItemT;
32
- itemIndex: number;
33
- absoluteItemIndex: number;
34
- };
35
- type SectionItemSeparator<ItemT, SectionT> = {
36
- kind: "item-separator";
37
- key: string;
38
- section: SectionT;
39
- sectionIndex: number;
40
- leadingItem: ItemT;
41
- leadingItemIndex: number;
42
- trailingItem?: ItemT;
43
- };
44
- type SectionSeparator<SectionT> = {
45
- kind: "section-separator";
46
- key: string;
47
- leadingSection: SectionT;
48
- leadingSectionIndex: number;
49
- trailingSection?: SectionT;
50
- };
51
- type FlatSectionListItem<ItemT, SectionT> = SectionHeaderItem<SectionT> | SectionFooterItem<SectionT> | SectionBodyItem<ItemT, SectionT> | SectionItemSeparator<ItemT, SectionT> | SectionSeparator<SectionT>;
52
- type SectionMeta = {
53
- header?: number;
54
- footer?: number;
55
- items: number[];
56
- };
57
- type BuildSectionListDataResult<ItemT, SectionT> = {
58
- data: Array<FlatSectionListItem<ItemT, SectionT>>;
59
- sectionMeta: SectionMeta[];
60
- stickyHeaderIndices: number[];
61
- };
62
-
63
- type SectionListViewToken<ItemT, SectionT> = {
64
- item: ItemT;
65
- key: string;
66
- index: number;
67
- isViewable: boolean;
68
- section: SectionListData<ItemT, SectionT>;
69
- };
70
- type SectionListOnViewableItemsChanged<ItemT, SectionT> = ((info: {
71
- viewableItems: Array<SectionListViewToken<ItemT, SectionT>>;
72
- changed: Array<SectionListViewToken<ItemT, SectionT>>;
73
- }) => void) | null;
74
- type SectionListLegendProps<ItemT, SectionT> = Omit<LegendListProps<FlatSectionListItem<ItemT, SectionT>>, "data" | "children" | "renderItem" | "keyExtractor" | "ItemSeparatorComponent" | "getItemType" | "getFixedItemSize" | "stickyHeaderIndices" | "numColumns" | "columnWrapperStyle" | "onViewableItemsChanged">;
75
- type SectionListProps<ItemT, SectionT extends SectionBase<ItemT> = SectionBase<ItemT>> = SectionListLegendProps<ItemT, SectionT> & {
76
- sections: ReadonlyArray<SectionListData<ItemT, SectionT>>;
77
- extraData?: any;
78
- renderItem?: (info: SectionListRenderItemInfo<ItemT, SectionT>) => React.ReactElement | null;
79
- renderSectionHeader?: (info: {
80
- section: SectionListData<ItemT, SectionT>;
81
- }) => React.ReactElement | null;
82
- renderSectionFooter?: (info: {
83
- section: SectionListData<ItemT, SectionT>;
84
- }) => React.ReactElement | null;
85
- ItemSeparatorComponent?: React.ComponentType<SectionListSeparatorProps<ItemT, SectionT>> | null;
86
- SectionSeparatorComponent?: React.ComponentType<SectionListSeparatorProps<ItemT, SectionT>> | React.ReactElement | null;
87
- keyExtractor?: (item: ItemT, index: number) => string;
88
- stickySectionHeadersEnabled?: boolean;
89
- onViewableItemsChanged?: SectionListOnViewableItemsChanged<ItemT, SectionT>;
90
- };
91
- type SectionListRef = LegendListRef & {
92
- scrollToLocation(params: SectionListScrollParams): void;
93
- };
94
- declare const SectionList: (<ItemT, SectionT extends SectionBase<ItemT, react_native.DefaultSectionT>>(props: SectionListLegendProps<ItemT, SectionT> & {
95
- sections: readonly SectionListData<ItemT, SectionT>[];
96
- extraData?: any;
97
- renderItem?: ((info: SectionListRenderItemInfo<ItemT, SectionT>) => React.ReactElement | null) | undefined;
98
- renderSectionHeader?: ((info: {
99
- section: SectionListData<ItemT, SectionT>;
100
- }) => React.ReactElement | null) | undefined;
101
- renderSectionFooter?: ((info: {
102
- section: SectionListData<ItemT, SectionT>;
103
- }) => React.ReactElement | null) | undefined;
104
- ItemSeparatorComponent?: React.ComponentType<SectionListSeparatorProps<ItemT, SectionT>> | null | undefined;
105
- SectionSeparatorComponent?: React.ReactElement<any, string | React.JSXElementConstructor<any>> | React.ComponentType<SectionListSeparatorProps<ItemT, SectionT>> | null | undefined;
106
- keyExtractor?: ((item: ItemT, index: number) => string) | undefined;
107
- stickySectionHeadersEnabled?: boolean;
108
- onViewableItemsChanged?: SectionListOnViewableItemsChanged<ItemT, SectionT> | undefined;
109
- } & React.RefAttributes<SectionListRef>) => React.ReactNode) & {
110
- displayName?: string;
111
- };
112
-
113
- export { type BuildSectionListDataResult, type FlatSectionListItem, SectionList, type SectionListOnViewableItemsChanged, type SectionListProps, type SectionListRef, type SectionListSeparatorProps, type SectionListViewToken, type SectionMeta };