@legendapp/list 2.0.0-next.2 → 2.0.0-next.4

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 (260) hide show
  1. package/{dist/index.d.mts → index.d.mts} +28 -21
  2. package/{dist/index.d.ts → index.d.ts} +28 -21
  3. package/{dist/index.js → index.js} +808 -760
  4. package/{dist/index.mjs → index.mjs} +808 -760
  5. package/{dist → integrations}/animated.d.mts +2 -1
  6. package/{dist → integrations}/animated.d.ts +2 -1
  7. package/{dist → integrations}/animated.js +2 -2
  8. package/{dist → integrations}/animated.mjs +2 -2
  9. package/{dist → integrations}/keyboard-controller.d.mts +4 -0
  10. package/{dist → integrations}/keyboard-controller.d.ts +4 -0
  11. package/{dist → integrations}/keyboard-controller.js +4 -4
  12. package/{dist → integrations}/keyboard-controller.mjs +4 -4
  13. package/{dist → integrations}/reanimated.js +7 -7
  14. package/{dist → integrations}/reanimated.mjs +7 -7
  15. package/package.json +34 -88
  16. package/.claude/settings.local.json +0 -8
  17. package/.cursor/rules/changelog.mdc +0 -60
  18. package/.github/FUNDING.yml +0 -15
  19. package/.gitignore +0 -5
  20. package/.prettierrc.json +0 -5
  21. package/.vscode/settings.json +0 -14
  22. package/CLAUDE.md +0 -126
  23. package/biome.json +0 -46
  24. package/bun.lock +0 -1289
  25. package/bunfig.toml +0 -2
  26. package/dist/CHANGELOG.md +0 -119
  27. package/dist/LICENSE +0 -21
  28. package/dist/README.md +0 -139
  29. package/dist/package.json +0 -35
  30. package/example/README.md +0 -40
  31. package/example/api/data/genres.json +0 -23
  32. package/example/api/data/playlist/10402-10749.json +0 -1
  33. package/example/api/data/playlist/10402-10770.json +0 -1
  34. package/example/api/data/playlist/10402-37.json +0 -1
  35. package/example/api/data/playlist/10749-10752.json +0 -1
  36. package/example/api/data/playlist/10749-10770.json +0 -1
  37. package/example/api/data/playlist/10749-37.json +0 -1
  38. package/example/api/data/playlist/10749-878.json +0 -1
  39. package/example/api/data/playlist/10751-10402.json +0 -1
  40. package/example/api/data/playlist/10751-10752.json +0 -1
  41. package/example/api/data/playlist/10751-37.json +0 -1
  42. package/example/api/data/playlist/10751-53.json +0 -1
  43. package/example/api/data/playlist/10751-878.json +0 -1
  44. package/example/api/data/playlist/10751-9648.json +0 -1
  45. package/example/api/data/playlist/10752-37.json +0 -1
  46. package/example/api/data/playlist/12-10402.json +0 -1
  47. package/example/api/data/playlist/12-10749.json +0 -1
  48. package/example/api/data/playlist/12-18.json +0 -1
  49. package/example/api/data/playlist/12-27.json +0 -1
  50. package/example/api/data/playlist/12-35.json +0 -1
  51. package/example/api/data/playlist/14-36.json +0 -1
  52. package/example/api/data/playlist/14-878.json +0 -1
  53. package/example/api/data/playlist/16-10751.json +0 -1
  54. package/example/api/data/playlist/16-10770.json +0 -1
  55. package/example/api/data/playlist/16-35.json +0 -1
  56. package/example/api/data/playlist/16-36.json +0 -1
  57. package/example/api/data/playlist/16-53.json +0 -1
  58. package/example/api/data/playlist/18-10751.json +0 -1
  59. package/example/api/data/playlist/18-10752.json +0 -1
  60. package/example/api/data/playlist/18-37.json +0 -1
  61. package/example/api/data/playlist/18-53.json +0 -1
  62. package/example/api/data/playlist/18-878.json +0 -1
  63. package/example/api/data/playlist/27-10749.json +0 -1
  64. package/example/api/data/playlist/27-10770.json +0 -1
  65. package/example/api/data/playlist/28-10749.json +0 -1
  66. package/example/api/data/playlist/28-10751.json +0 -1
  67. package/example/api/data/playlist/28-10770.json +0 -1
  68. package/example/api/data/playlist/28-16.json +0 -1
  69. package/example/api/data/playlist/28-18.json +0 -1
  70. package/example/api/data/playlist/28-36.json +0 -1
  71. package/example/api/data/playlist/28-37.json +0 -1
  72. package/example/api/data/playlist/28-53.json +0 -1
  73. package/example/api/data/playlist/28-80.json +0 -1
  74. package/example/api/data/playlist/28-99.json +0 -1
  75. package/example/api/data/playlist/35-10749.json +0 -1
  76. package/example/api/data/playlist/35-10751.json +0 -1
  77. package/example/api/data/playlist/35-10752.json +0 -1
  78. package/example/api/data/playlist/35-27.json +0 -1
  79. package/example/api/data/playlist/35-36.json +0 -1
  80. package/example/api/data/playlist/35-53.json +0 -1
  81. package/example/api/data/playlist/35-80.json +0 -1
  82. package/example/api/data/playlist/36-37.json +0 -1
  83. package/example/api/data/playlist/36-878.json +0 -1
  84. package/example/api/data/playlist/36-9648.json +0 -1
  85. package/example/api/data/playlist/53-10752.json +0 -1
  86. package/example/api/data/playlist/80-10770.json +0 -1
  87. package/example/api/data/playlist/80-14.json +0 -1
  88. package/example/api/data/playlist/80-18.json +0 -1
  89. package/example/api/data/playlist/80-37.json +0 -1
  90. package/example/api/data/playlist/878-37.json +0 -1
  91. package/example/api/data/playlist/9648-10770.json +0 -1
  92. package/example/api/data/playlist/9648-37.json +0 -1
  93. package/example/api/data/playlist/9648-53.json +0 -1
  94. package/example/api/data/playlist/9648-878.json +0 -1
  95. package/example/api/data/playlist/99-10749.json +0 -1
  96. package/example/api/data/playlist/99-14.json +0 -1
  97. package/example/api/data/playlist/99-18.json +0 -1
  98. package/example/api/data/playlist/99-27.json +0 -1
  99. package/example/api/data/playlist/99-53.json +0 -1
  100. package/example/api/data/playlist/99-9648.json +0 -1
  101. package/example/api/data/playlist/index.ts +0 -73
  102. package/example/api/data/rows.json +0 -1
  103. package/example/api/index.ts +0 -36
  104. package/example/app/(tabs)/_layout.tsx +0 -60
  105. package/example/app/(tabs)/cards.tsx +0 -81
  106. package/example/app/(tabs)/index.tsx +0 -205
  107. package/example/app/(tabs)/moviesL.tsx +0 -7
  108. package/example/app/(tabs)/moviesLR.tsx +0 -7
  109. package/example/app/+not-found.tsx +0 -32
  110. package/example/app/_layout.tsx +0 -34
  111. package/example/app/accurate-scrollto/index.tsx +0 -125
  112. package/example/app/accurate-scrollto-2/index.tsx +0 -52
  113. package/example/app/accurate-scrollto-huge/index.tsx +0 -128
  114. package/example/app/add-to-end/index.tsx +0 -82
  115. package/example/app/ai-chat/index.tsx +0 -236
  116. package/example/app/bidirectional-infinite-list/index.tsx +0 -133
  117. package/example/app/cards-columns/index.tsx +0 -37
  118. package/example/app/cards-flashlist/index.tsx +0 -122
  119. package/example/app/cards-flatlist/index.tsx +0 -94
  120. package/example/app/cards-no-recycle/index.tsx +0 -110
  121. package/example/app/cards-renderItem.tsx +0 -354
  122. package/example/app/chat-example/index.tsx +0 -167
  123. package/example/app/chat-infinite/index.tsx +0 -239
  124. package/example/app/chat-keyboard/index.tsx +0 -248
  125. package/example/app/chat-resize-outer/index.tsx +0 -247
  126. package/example/app/columns/index.tsx +0 -78
  127. package/example/app/countries/index.tsx +0 -182
  128. package/example/app/countries-flashlist/index.tsx +0 -163
  129. package/example/app/countries-reorder/index.tsx +0 -187
  130. package/example/app/extra-data/index.tsx +0 -86
  131. package/example/app/filter-elements/filter-data-provider.tsx +0 -55
  132. package/example/app/filter-elements/index.tsx +0 -118
  133. package/example/app/initial-scroll-index/index.tsx +0 -106
  134. package/example/app/initial-scroll-index/renderFixedItem.tsx +0 -215
  135. package/example/app/initial-scroll-index-free-height/index.tsx +0 -70
  136. package/example/app/initial-scroll-index-keyed/index.tsx +0 -62
  137. package/example/app/lazy-list/index.tsx +0 -123
  138. package/example/app/movies-flashlist/index.tsx +0 -7
  139. package/example/app/mutable-cells/index.tsx +0 -104
  140. package/example/app/video-feed/index.tsx +0 -119
  141. package/example/app.config.js +0 -22
  142. package/example/app.json +0 -45
  143. package/example/assets/fonts/SpaceMono-Regular.ttf +0 -0
  144. package/example/assets/images/adaptive-icon.png +0 -0
  145. package/example/assets/images/favicon.png +0 -0
  146. package/example/assets/images/icon.png +0 -0
  147. package/example/assets/images/partial-react-logo.png +0 -0
  148. package/example/assets/images/react-logo.png +0 -0
  149. package/example/assets/images/react-logo@2x.png +0 -0
  150. package/example/assets/images/react-logo@3x.png +0 -0
  151. package/example/assets/images/splash-icon.png +0 -0
  152. package/example/autoscroll.sh +0 -101
  153. package/example/bun.lock +0 -2266
  154. package/example/bunfig.toml +0 -2
  155. package/example/components/Breathe.tsx +0 -54
  156. package/example/components/Circle.tsx +0 -69
  157. package/example/components/Collapsible.tsx +0 -44
  158. package/example/components/ExternalLink.tsx +0 -24
  159. package/example/components/HapticTab.tsx +0 -18
  160. package/example/components/HelloWave.tsx +0 -37
  161. package/example/components/Movies.tsx +0 -179
  162. package/example/components/ParallaxScrollView.tsx +0 -81
  163. package/example/components/ThemedText.tsx +0 -60
  164. package/example/components/ThemedView.tsx +0 -14
  165. package/example/components/__tests__/ThemedText-test.tsx +0 -10
  166. package/example/components/__tests__/__snapshots__/ThemedText-test.tsx.snap +0 -24
  167. package/example/components/ui/IconSymbol.ios.tsx +0 -32
  168. package/example/components/ui/IconSymbol.tsx +0 -43
  169. package/example/components/ui/TabBarBackground.ios.tsx +0 -22
  170. package/example/components/ui/TabBarBackground.tsx +0 -6
  171. package/example/constants/Colors.ts +0 -26
  172. package/example/constants/constants.ts +0 -5
  173. package/example/constants/useScrollTest.ts +0 -19
  174. package/example/hooks/useColorScheme.ts +0 -1
  175. package/example/hooks/useColorScheme.web.ts +0 -8
  176. package/example/hooks/useThemeColor.ts +0 -22
  177. package/example/ios/.xcode.env +0 -11
  178. package/example/ios/Podfile +0 -64
  179. package/example/ios/Podfile.lock +0 -2767
  180. package/example/ios/Podfile.properties.json +0 -5
  181. package/example/ios/listtest/AppDelegate.swift +0 -70
  182. package/example/ios/listtest/Images.xcassets/AppIcon.appiconset/App-Icon-1024x1024@1x.png +0 -0
  183. package/example/ios/listtest/Images.xcassets/AppIcon.appiconset/Contents.json +0 -14
  184. package/example/ios/listtest/Images.xcassets/Contents.json +0 -6
  185. package/example/ios/listtest/Images.xcassets/SplashScreenBackground.colorset/Contents.json +0 -20
  186. package/example/ios/listtest/Images.xcassets/SplashScreenLogo.imageset/Contents.json +0 -23
  187. package/example/ios/listtest/Images.xcassets/SplashScreenLogo.imageset/image.png +0 -0
  188. package/example/ios/listtest/Images.xcassets/SplashScreenLogo.imageset/image@2x.png +0 -0
  189. package/example/ios/listtest/Images.xcassets/SplashScreenLogo.imageset/image@3x.png +0 -0
  190. package/example/ios/listtest/Info.plist +0 -85
  191. package/example/ios/listtest/PrivacyInfo.xcprivacy +0 -48
  192. package/example/ios/listtest/SplashScreen.storyboard +0 -42
  193. package/example/ios/listtest/Supporting/Expo.plist +0 -12
  194. package/example/ios/listtest/listtest-Bridging-Header.h +0 -3
  195. package/example/ios/listtest/listtest.entitlements +0 -5
  196. package/example/ios/listtest.xcodeproj/project.pbxproj +0 -547
  197. package/example/ios/listtest.xcodeproj/xcshareddata/xcschemes/listtest.xcscheme +0 -88
  198. package/example/ios/listtest.xcworkspace/contents.xcworkspacedata +0 -10
  199. package/example/metro.config.js +0 -16
  200. package/example/package.json +0 -73
  201. package/example/scripts/reset-project.js +0 -84
  202. package/example/tsconfig.json +0 -26
  203. package/posttsup.ts +0 -24
  204. package/src/Container.tsx +0 -176
  205. package/src/Containers.tsx +0 -85
  206. package/src/ContextContainer.ts +0 -145
  207. package/src/DebugView.tsx +0 -83
  208. package/src/LazyLegendList.tsx +0 -41
  209. package/src/LeanView.tsx +0 -18
  210. package/src/LegendList.tsx +0 -558
  211. package/src/ListComponent.tsx +0 -191
  212. package/src/ScrollAdjust.tsx +0 -24
  213. package/src/ScrollAdjustHandler.ts +0 -26
  214. package/src/Separator.tsx +0 -14
  215. package/src/animated.tsx +0 -6
  216. package/src/calculateItemsInView.ts +0 -363
  217. package/src/calculateOffsetForIndex.ts +0 -23
  218. package/src/calculateOffsetWithOffsetPosition.ts +0 -26
  219. package/src/checkAllSizesKnown.ts +0 -17
  220. package/src/checkAtBottom.ts +0 -36
  221. package/src/checkAtTop.ts +0 -27
  222. package/src/checkThreshold.ts +0 -30
  223. package/src/constants.ts +0 -11
  224. package/src/createColumnWrapperStyle.ts +0 -16
  225. package/src/doInitialAllocateContainers.ts +0 -40
  226. package/src/doMaintainScrollAtEnd.ts +0 -34
  227. package/src/findAvailableContainers.ts +0 -98
  228. package/src/finishScrollTo.ts +0 -8
  229. package/src/getId.ts +0 -21
  230. package/src/getItemSize.ts +0 -52
  231. package/src/getRenderedItem.ts +0 -34
  232. package/src/getScrollVelocity.ts +0 -47
  233. package/src/handleLayout.ts +0 -70
  234. package/src/helpers.ts +0 -39
  235. package/src/index.ts +0 -11
  236. package/src/keyboard-controller.tsx +0 -63
  237. package/src/onScroll.ts +0 -66
  238. package/src/prepareMVCP.ts +0 -50
  239. package/src/reanimated.tsx +0 -63
  240. package/src/requestAdjust.ts +0 -41
  241. package/src/scrollTo.ts +0 -40
  242. package/src/scrollToIndex.ts +0 -34
  243. package/src/setDidLayout.ts +0 -25
  244. package/src/setPaddingTop.ts +0 -28
  245. package/src/state.tsx +0 -304
  246. package/src/types.ts +0 -610
  247. package/src/updateAlignItemsPaddingTop.ts +0 -18
  248. package/src/updateAllPositions.ts +0 -130
  249. package/src/updateItemSize.ts +0 -203
  250. package/src/updateTotalSize.ts +0 -44
  251. package/src/useAnimatedValue.ts +0 -6
  252. package/src/useCombinedRef.ts +0 -22
  253. package/src/useInit.ts +0 -17
  254. package/src/useSyncLayout.tsx +0 -68
  255. package/src/useValue$.ts +0 -53
  256. package/src/viewability.ts +0 -279
  257. package/tsconfig.json +0 -59
  258. package/tsup.config.ts +0 -21
  259. package/{dist → integrations}/reanimated.d.mts +1 -1
  260. package/{dist → integrations}/reanimated.d.ts +1 -1
@@ -1,279 +0,0 @@
1
- import { getId } from "./getId";
2
- import { type StateContext, peek$ } from "./state";
3
- import type {
4
- InternalState,
5
- LegendListProps,
6
- ViewAmountToken,
7
- ViewToken,
8
- ViewabilityConfig,
9
- ViewabilityConfigCallbackPair,
10
- ViewabilityConfigCallbackPairs,
11
- } from "./types";
12
-
13
- const mapViewabilityConfigCallbackPairs = new Map<
14
- string,
15
- {
16
- viewableItems: ViewToken[];
17
- start: number;
18
- end: number;
19
- previousStart: number;
20
- previousEnd: number;
21
- }
22
- >();
23
-
24
- export function setupViewability(
25
- props: Pick<
26
- LegendListProps<any>,
27
- "viewabilityConfig" | "viewabilityConfigCallbackPairs" | "onViewableItemsChanged"
28
- >,
29
- ): ViewabilityConfigCallbackPairs | undefined {
30
- let { viewabilityConfig, viewabilityConfigCallbackPairs, onViewableItemsChanged } = props;
31
-
32
- if (viewabilityConfig || onViewableItemsChanged) {
33
- viewabilityConfigCallbackPairs = [
34
- ...(viewabilityConfigCallbackPairs! || []),
35
- {
36
- viewabilityConfig:
37
- viewabilityConfig ||
38
- ({
39
- viewAreaCoveragePercentThreshold: 0,
40
- } as any),
41
- onViewableItemsChanged,
42
- },
43
- ];
44
- }
45
-
46
- if (viewabilityConfigCallbackPairs) {
47
- for (const pair of viewabilityConfigCallbackPairs) {
48
- mapViewabilityConfigCallbackPairs.set(pair.viewabilityConfig.id!, {
49
- viewableItems: [],
50
- start: -1,
51
- end: -1,
52
- previousStart: -1,
53
- previousEnd: -1,
54
- });
55
- }
56
- }
57
-
58
- return viewabilityConfigCallbackPairs;
59
- }
60
-
61
- export function updateViewableItems(
62
- state: InternalState,
63
- ctx: StateContext,
64
- viewabilityConfigCallbackPairs: ViewabilityConfigCallbackPair[],
65
- scrollSize: number,
66
- start: number,
67
- end: number,
68
- ) {
69
- for (const viewabilityConfigCallbackPair of viewabilityConfigCallbackPairs) {
70
- const viewabilityState = mapViewabilityConfigCallbackPairs.get(
71
- viewabilityConfigCallbackPair.viewabilityConfig.id!,
72
- )!;
73
- viewabilityState.start = start;
74
- viewabilityState.end = end;
75
- if (viewabilityConfigCallbackPair.viewabilityConfig.minimumViewTime) {
76
- const timer: any = setTimeout(() => {
77
- state.timeouts.delete(timer);
78
- updateViewableItemsWithConfig(state.data, viewabilityConfigCallbackPair, state, ctx, scrollSize);
79
- }, viewabilityConfigCallbackPair.viewabilityConfig.minimumViewTime);
80
- state.timeouts.add(timer);
81
- } else {
82
- updateViewableItemsWithConfig(state.data, viewabilityConfigCallbackPair, state, ctx, scrollSize);
83
- }
84
- }
85
- }
86
-
87
- function updateViewableItemsWithConfig(
88
- data: readonly any[],
89
- viewabilityConfigCallbackPair: ViewabilityConfigCallbackPair,
90
- state: InternalState,
91
- ctx: StateContext,
92
- scrollSize: number,
93
- ) {
94
- const { viewabilityConfig, onViewableItemsChanged } = viewabilityConfigCallbackPair;
95
- const configId = viewabilityConfig.id!;
96
- const viewabilityState = mapViewabilityConfigCallbackPairs.get(configId)!;
97
- const { viewableItems: previousViewableItems, start, end } = viewabilityState;
98
-
99
- const viewabilityTokens = new Map<number, ViewAmountToken>();
100
- for (const [containerId, value] of ctx.mapViewabilityAmountValues) {
101
- viewabilityTokens.set(
102
- containerId,
103
- computeViewability(
104
- state,
105
- ctx,
106
- viewabilityConfig,
107
- containerId,
108
- value.key,
109
- scrollSize,
110
- value.item,
111
- value.index,
112
- ),
113
- );
114
- }
115
- const changed: ViewToken[] = [];
116
- if (previousViewableItems) {
117
- for (const viewToken of previousViewableItems) {
118
- const containerId = findContainerId(ctx, viewToken.key);
119
- if (
120
- !isViewable(
121
- state,
122
- ctx,
123
- viewabilityConfig,
124
- containerId,
125
- viewToken.key,
126
- scrollSize,
127
- viewToken.item,
128
- viewToken.index,
129
- )
130
- ) {
131
- viewToken.isViewable = false;
132
- changed.push(viewToken);
133
- }
134
- }
135
- }
136
-
137
- const viewableItems: ViewToken[] = [];
138
-
139
- for (let i = start; i <= end; i++) {
140
- const item = data[i];
141
- if (item) {
142
- const key = getId(state, i);
143
- const containerId = findContainerId(ctx, key);
144
- if (isViewable(state, ctx, viewabilityConfig, containerId, key, scrollSize, item, i)) {
145
- const viewToken: ViewToken = {
146
- item,
147
- key,
148
- index: i,
149
- isViewable: true,
150
- containerId,
151
- };
152
- viewableItems.push(viewToken);
153
- if (!previousViewableItems?.find((v) => v.key === viewToken.key)) {
154
- changed.push(viewToken);
155
- }
156
- }
157
- }
158
- }
159
-
160
- Object.assign(viewabilityState, {
161
- viewableItems,
162
- previousStart: start,
163
- previousEnd: end,
164
- });
165
-
166
- if (changed.length > 0) {
167
- viewabilityState.viewableItems = viewableItems;
168
-
169
- for (let i = 0; i < changed.length; i++) {
170
- const change = changed[i];
171
- maybeUpdateViewabilityCallback(ctx, configId, change.containerId, change);
172
- }
173
-
174
- if (onViewableItemsChanged) {
175
- onViewableItemsChanged({ viewableItems, changed });
176
- }
177
- }
178
-
179
- for (const [containerId, value] of ctx.mapViewabilityAmountValues) {
180
- if (value.sizeVisible < 0) {
181
- ctx.mapViewabilityAmountValues.delete(containerId);
182
- }
183
- }
184
- }
185
-
186
- function computeViewability(
187
- state: InternalState,
188
- ctx: StateContext,
189
- viewabilityConfig: ViewabilityConfig,
190
- containerId: number,
191
- key: string,
192
- scrollSize: number,
193
- item: any,
194
- index: number,
195
- ): ViewAmountToken {
196
- const { sizes, positions, scroll: scrollState } = state;
197
- const topPad = (peek$(ctx, "stylePaddingTop") || 0) + (peek$(ctx, "headerSize") || 0);
198
- const { itemVisiblePercentThreshold, viewAreaCoveragePercentThreshold } = viewabilityConfig;
199
- const viewAreaMode = viewAreaCoveragePercentThreshold != null;
200
- const viewablePercentThreshold = viewAreaMode ? viewAreaCoveragePercentThreshold : itemVisiblePercentThreshold;
201
- const scroll = scrollState - topPad;
202
-
203
- const top = positions.get(key)! - scroll;
204
- const size = sizes.get(key)! || 0;
205
- const bottom = top + size;
206
- const isEntirelyVisible = top >= 0 && bottom <= scrollSize && bottom > top;
207
-
208
- const sizeVisible = isEntirelyVisible ? size : Math.min(bottom, scrollSize) - Math.max(top, 0);
209
- const percentVisible = size ? (isEntirelyVisible ? 100 : 100 * (sizeVisible / size)) : 0;
210
- const percentOfScroller = size ? 100 * (sizeVisible / scrollSize) : 0;
211
- const percent = isEntirelyVisible ? 100 : viewAreaMode ? percentOfScroller : percentVisible;
212
-
213
- const isViewable = percent >= viewablePercentThreshold!;
214
-
215
- const value: ViewAmountToken = {
216
- index,
217
- isViewable,
218
- item,
219
- key,
220
- percentVisible,
221
- percentOfScroller,
222
- sizeVisible,
223
- size,
224
- scrollSize,
225
- containerId,
226
- };
227
-
228
- if (JSON.stringify(value) !== JSON.stringify(ctx.mapViewabilityAmountValues.get(containerId))) {
229
- ctx.mapViewabilityAmountValues.set(containerId, value);
230
- const cb = ctx.mapViewabilityAmountCallbacks.get(containerId);
231
- if (cb) {
232
- cb(value);
233
- }
234
- }
235
-
236
- return value;
237
- }
238
-
239
- function isViewable(
240
- state: InternalState,
241
- ctx: StateContext,
242
- viewabilityConfig: ViewabilityConfig,
243
- containerId: number,
244
- key: string,
245
- scrollSize: number,
246
- item: any,
247
- index: number,
248
- ) {
249
- const value =
250
- ctx.mapViewabilityAmountValues.get(containerId) ||
251
- computeViewability(state, ctx, viewabilityConfig, containerId, key, scrollSize, item, index);
252
-
253
- return value.isViewable;
254
- }
255
-
256
- function findContainerId(ctx: StateContext, key: string) {
257
- const numContainers = peek$(ctx, "numContainers");
258
- for (let i = 0; i < numContainers; i++) {
259
- const itemKey = peek$(ctx, `containerItemKey${i}`);
260
- if (itemKey === key) {
261
- return i;
262
- }
263
- }
264
- return -1;
265
- }
266
-
267
- function maybeUpdateViewabilityCallback(
268
- ctx: StateContext,
269
- configId: string,
270
- containerId: number,
271
- viewToken: ViewToken,
272
- ) {
273
- const key = containerId + configId;
274
-
275
- ctx.mapViewabilityValues.set(key, viewToken);
276
-
277
- const cb = ctx.mapViewabilityCallbacks.get(key);
278
- cb?.(viewToken);
279
- }
package/tsconfig.json DELETED
@@ -1,59 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "outDir": "dist",
4
- "target": "es2018",
5
- "module": "ES2015",
6
- "lib": [
7
- "dom",
8
- "dom.iterable",
9
- "esnext"
10
- ],
11
- "skipLibCheck": true,
12
- "strict": true,
13
- "allowSyntheticDefaultImports": true,
14
- "forceConsistentCasingInFileNames": true,
15
- "incremental": true,
16
- "tsBuildInfoFile": "./tsconfig.tsbuildinfo", // Specify the build info file
17
- "esModuleInterop": true,
18
- "moduleResolution": "node",
19
- "isolatedModules": true,
20
- "jsx": "preserve",
21
- "stripInternal": true,
22
- "baseUrl": ".",
23
- "rootDirs": [
24
- "./src",
25
- ],
26
- "declaration": true,
27
- "declarationMap": false,
28
- "sourceMap": true,
29
- "paths": {
30
- "react": [
31
- "node_modules/react"
32
- ],
33
- "react-native": [
34
- "node_modules/react-native"
35
- ],
36
- "@legendapp/list": [
37
- "src/index"
38
- ],
39
- "@legendapp/list/animated": [
40
- "src/animated"
41
- ],
42
- "@legendapp/list/reanimated": [
43
- "src/reanimated"
44
- ],
45
- },
46
- "resolveJsonModule": true,
47
- "noEmit": true
48
- },
49
- "include": [
50
- "**/*.ts",
51
- "**/*.tsx"
52
- ],
53
- "exclude": [
54
- "node_modules",
55
- "dist",
56
- "types.d.ts",
57
- "src/types"
58
- ],
59
- }
package/tsup.config.ts DELETED
@@ -1,21 +0,0 @@
1
- import { defineConfig } from "tsup";
2
-
3
- const external = [
4
- "react",
5
- "react-native",
6
- "react-native-keyboard-controller",
7
- "react-native-reanimated",
8
- "@legendapp/list",
9
- "@legendapp/list/animated",
10
- "@legendapp/list/reanimated",
11
- ];
12
-
13
- export default defineConfig({
14
- entry: ["src/index.ts", "src/animated.tsx", "src/reanimated.tsx", "src/keyboard-controller.tsx"],
15
- format: ["cjs", "esm"],
16
- external,
17
- dts: true,
18
- treeshake: true,
19
- splitting: false,
20
- clean: true,
21
- });
@@ -1,6 +1,6 @@
1
- import { LegendListPropsBase, LegendListRef } from '@legendapp/list';
2
1
  import React__default, { ComponentProps } from 'react';
3
2
  import Animated from 'react-native-reanimated';
3
+ import { LegendListPropsBase, LegendListRef } from '@legendapp/list';
4
4
 
5
5
  type KeysToOmit = "getEstimatedItemSize" | "keyExtractor" | "animatedProps" | "renderItem" | "onItemSizeChanged" | "ItemSeparatorComponent";
6
6
  type PropsBase<ItemT> = LegendListPropsBase<ItemT, ComponentProps<typeof Animated.ScrollView>>;
@@ -1,6 +1,6 @@
1
- import { LegendListPropsBase, LegendListRef } from '@legendapp/list';
2
1
  import React__default, { ComponentProps } from 'react';
3
2
  import Animated from 'react-native-reanimated';
3
+ import { LegendListPropsBase, LegendListRef } from '@legendapp/list';
4
4
 
5
5
  type KeysToOmit = "getEstimatedItemSize" | "keyExtractor" | "animatedProps" | "renderItem" | "onItemSizeChanged" | "ItemSeparatorComponent";
6
6
  type PropsBase<ItemT> = LegendListPropsBase<ItemT, ComponentProps<typeof Animated.ScrollView>>;