@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
@@ -56,7 +56,7 @@ declare const AnimatedLegendList: Animated.AnimatedComponent<(<T>(props: Omit<Om
56
56
  recycleItems?: boolean;
57
57
  refScrollView?: React.Ref<react_native.ScrollView>;
58
58
  refreshing?: boolean;
59
- renderItem?: React$1.ComponentType<_legendapp_list.LegendListRenderItemProps<T>> | ((props: _legendapp_list.LegendListRenderItemProps<T>) => React$1.ReactNode) | undefined;
59
+ renderItem?: ((props: _legendapp_list.LegendListRenderItemProps<T>) => React$1.ReactNode) | React$1.ComponentType<_legendapp_list.LegendListRenderItemProps<T>> | undefined;
60
60
  renderScrollComponent?: (props: react_native.ScrollViewProps) => React.ReactElement<react_native.ScrollViewProps>;
61
61
  suggestEstimatedItemSize?: boolean;
62
62
  viewabilityConfig?: _legendapp_list.ViewabilityConfig;
@@ -65,6 +65,7 @@ declare const AnimatedLegendList: Animated.AnimatedComponent<(<T>(props: Omit<Om
65
65
  onLoad?: (info: {
66
66
  elapsedTimeInMs: number;
67
67
  }) => void;
68
+ snapToIndices?: number[];
68
69
  } & React$1.RefAttributes<_legendapp_list.LegendListRef>) => React.ReactNode)>;
69
70
 
70
71
  export { AnimatedLegendList };
@@ -56,7 +56,7 @@ declare const AnimatedLegendList: Animated.AnimatedComponent<(<T>(props: Omit<Om
56
56
  recycleItems?: boolean;
57
57
  refScrollView?: React.Ref<react_native.ScrollView>;
58
58
  refreshing?: boolean;
59
- renderItem?: React$1.ComponentType<_legendapp_list.LegendListRenderItemProps<T>> | ((props: _legendapp_list.LegendListRenderItemProps<T>) => React$1.ReactNode) | undefined;
59
+ renderItem?: ((props: _legendapp_list.LegendListRenderItemProps<T>) => React$1.ReactNode) | React$1.ComponentType<_legendapp_list.LegendListRenderItemProps<T>> | undefined;
60
60
  renderScrollComponent?: (props: react_native.ScrollViewProps) => React.ReactElement<react_native.ScrollViewProps>;
61
61
  suggestEstimatedItemSize?: boolean;
62
62
  viewabilityConfig?: _legendapp_list.ViewabilityConfig;
@@ -65,6 +65,7 @@ declare const AnimatedLegendList: Animated.AnimatedComponent<(<T>(props: Omit<Om
65
65
  onLoad?: (info: {
66
66
  elapsedTimeInMs: number;
67
67
  }) => void;
68
+ snapToIndices?: number[];
68
69
  } & React$1.RefAttributes<_legendapp_list.LegendListRef>) => React.ReactNode)>;
69
70
 
70
71
  export { AnimatedLegendList };
@@ -1,9 +1,9 @@
1
1
  'use strict';
2
2
 
3
- var list = require('@legendapp/list');
4
3
  var reactNative = require('react-native');
4
+ var list = require('@legendapp/list');
5
5
 
6
- // src/animated.tsx
6
+ // src/integrations/animated.tsx
7
7
  var AnimatedLegendList = reactNative.Animated.createAnimatedComponent(list.LegendList);
8
8
 
9
9
  exports.AnimatedLegendList = AnimatedLegendList;
@@ -1,7 +1,7 @@
1
- import { LegendList } from '@legendapp/list';
2
1
  import { Animated } from 'react-native';
2
+ import { LegendList } from '@legendapp/list';
3
3
 
4
- // src/animated.tsx
4
+ // src/integrations/animated.tsx
5
5
  var AnimatedLegendList = Animated.createAnimatedComponent(LegendList);
6
6
 
7
7
  export { AnimatedLegendList };
@@ -66,6 +66,7 @@ declare const LegendList: <ItemT, ListT extends (<T>(props: Omit<Omit<react_nati
66
66
  onLoad?: (info: {
67
67
  elapsedTimeInMs: number;
68
68
  }) => void;
69
+ snapToIndices?: number[];
69
70
  } & React.RefAttributes<LegendListRef>) => React.ReactNode) | react_native.Animated.AnimatedComponent<(<T>(props: Omit<Omit<react_native.ScrollViewProps, "scrollEventThrottle">, "contentOffset" | "contentInset" | "maintainVisibleContentPosition" | "stickyHeaderIndices" | "removeClippedSubviews" | "children"> & {
70
71
  alignItemsAtEnd?: boolean;
71
72
  columnWrapperStyle?: _legendapp_list.ColumnWrapperStyle;
@@ -128,6 +129,7 @@ declare const LegendList: <ItemT, ListT extends (<T>(props: Omit<Omit<react_nati
128
129
  onLoad?: (info: {
129
130
  elapsedTimeInMs: number;
130
131
  }) => void;
132
+ snapToIndices?: number[];
131
133
  } & React.RefAttributes<LegendListRef>) => React.ReactNode)> | (<ItemT_1>(props: _legendapp_list_reanimated.AnimatedLegendListProps<ItemT_1> & {
132
134
  ref?: React.Ref<LegendListRef>;
133
135
  }) => React.ReactElement | null) = <T>(props: Omit<Omit<react_native.ScrollViewProps, "scrollEventThrottle">, "contentOffset" | "contentInset" | "maintainVisibleContentPosition" | "stickyHeaderIndices" | "removeClippedSubviews" | "children"> & {
@@ -192,6 +194,7 @@ declare const LegendList: <ItemT, ListT extends (<T>(props: Omit<Omit<react_nati
192
194
  onLoad?: (info: {
193
195
  elapsedTimeInMs: number;
194
196
  }) => void;
197
+ snapToIndices?: number[];
195
198
  } & React.RefAttributes<LegendListRef>) => React.ReactNode>(props: Omit<Omit<react_native.ScrollViewProps, "scrollEventThrottle">, "contentOffset" | "contentInset" | "maintainVisibleContentPosition" | "stickyHeaderIndices" | "removeClippedSubviews" | "children"> & {
196
199
  alignItemsAtEnd?: boolean;
197
200
  columnWrapperStyle?: _legendapp_list.ColumnWrapperStyle;
@@ -254,6 +257,7 @@ declare const LegendList: <ItemT, ListT extends (<T>(props: Omit<Omit<react_nati
254
257
  onLoad?: (info: {
255
258
  elapsedTimeInMs: number;
256
259
  }) => void;
260
+ snapToIndices?: number[];
257
261
  } & {
258
262
  LegendList?: ListT;
259
263
  } & React.RefAttributes<LegendListRef>) => React.ReactNode;
@@ -66,6 +66,7 @@ declare const LegendList: <ItemT, ListT extends (<T>(props: Omit<Omit<react_nati
66
66
  onLoad?: (info: {
67
67
  elapsedTimeInMs: number;
68
68
  }) => void;
69
+ snapToIndices?: number[];
69
70
  } & React.RefAttributes<LegendListRef>) => React.ReactNode) | react_native.Animated.AnimatedComponent<(<T>(props: Omit<Omit<react_native.ScrollViewProps, "scrollEventThrottle">, "contentOffset" | "contentInset" | "maintainVisibleContentPosition" | "stickyHeaderIndices" | "removeClippedSubviews" | "children"> & {
70
71
  alignItemsAtEnd?: boolean;
71
72
  columnWrapperStyle?: _legendapp_list.ColumnWrapperStyle;
@@ -128,6 +129,7 @@ declare const LegendList: <ItemT, ListT extends (<T>(props: Omit<Omit<react_nati
128
129
  onLoad?: (info: {
129
130
  elapsedTimeInMs: number;
130
131
  }) => void;
132
+ snapToIndices?: number[];
131
133
  } & React.RefAttributes<LegendListRef>) => React.ReactNode)> | (<ItemT_1>(props: _legendapp_list_reanimated.AnimatedLegendListProps<ItemT_1> & {
132
134
  ref?: React.Ref<LegendListRef>;
133
135
  }) => React.ReactElement | null) = <T>(props: Omit<Omit<react_native.ScrollViewProps, "scrollEventThrottle">, "contentOffset" | "contentInset" | "maintainVisibleContentPosition" | "stickyHeaderIndices" | "removeClippedSubviews" | "children"> & {
@@ -192,6 +194,7 @@ declare const LegendList: <ItemT, ListT extends (<T>(props: Omit<Omit<react_nati
192
194
  onLoad?: (info: {
193
195
  elapsedTimeInMs: number;
194
196
  }) => void;
197
+ snapToIndices?: number[];
195
198
  } & React.RefAttributes<LegendListRef>) => React.ReactNode>(props: Omit<Omit<react_native.ScrollViewProps, "scrollEventThrottle">, "contentOffset" | "contentInset" | "maintainVisibleContentPosition" | "stickyHeaderIndices" | "removeClippedSubviews" | "children"> & {
196
199
  alignItemsAtEnd?: boolean;
197
200
  columnWrapperStyle?: _legendapp_list.ColumnWrapperStyle;
@@ -254,6 +257,7 @@ declare const LegendList: <ItemT, ListT extends (<T>(props: Omit<Omit<react_nati
254
257
  onLoad?: (info: {
255
258
  elapsedTimeInMs: number;
256
259
  }) => void;
260
+ snapToIndices?: number[];
257
261
  } & {
258
262
  LegendList?: ListT;
259
263
  } & React.RefAttributes<LegendListRef>) => React.ReactNode;
@@ -1,10 +1,10 @@
1
1
  'use strict';
2
2
 
3
- var list = require('@legendapp/list');
4
3
  var React = require('react');
5
4
  var reactNative = require('react-native');
6
5
  var reactNativeKeyboardController = require('react-native-keyboard-controller');
7
6
  var reactNativeReanimated = require('react-native-reanimated');
7
+ var list = require('@legendapp/list');
8
8
 
9
9
  function _interopNamespace(e) {
10
10
  if (e && e.__esModule) return e;
@@ -26,7 +26,7 @@ function _interopNamespace(e) {
26
26
 
27
27
  var React__namespace = /*#__PURE__*/_interopNamespace(React);
28
28
 
29
- // src/keyboard-controller.tsx
29
+ // src/integrations/keyboard-controller.tsx
30
30
  var typedForwardRef = React.forwardRef;
31
31
  var LegendList = typedForwardRef(function LegendList2(props, forwardedRef) {
32
32
  const {
@@ -59,8 +59,8 @@ var LegendList = typedForwardRef(function LegendList2(props, forwardedRef) {
59
59
  {
60
60
  ...rest,
61
61
  contentContainerStyle,
62
- scrollIndicatorInsets,
63
- ref: forwardedRef
62
+ ref: forwardedRef,
63
+ scrollIndicatorInsets
64
64
  }
65
65
  )
66
66
  );
@@ -1,11 +1,11 @@
1
- import { LegendList as LegendList$1 } from '@legendapp/list';
2
1
  import * as React from 'react';
3
2
  import { useState, forwardRef } from 'react';
4
3
  import { StyleSheet } from 'react-native';
5
4
  import { useKeyboardHandler } from 'react-native-keyboard-controller';
6
5
  import { runOnJS } from 'react-native-reanimated';
6
+ import { LegendList as LegendList$1 } from '@legendapp/list';
7
7
 
8
- // src/keyboard-controller.tsx
8
+ // src/integrations/keyboard-controller.tsx
9
9
  var typedForwardRef = forwardRef;
10
10
  var LegendList = typedForwardRef(function LegendList2(props, forwardedRef) {
11
11
  const {
@@ -38,8 +38,8 @@ var LegendList = typedForwardRef(function LegendList2(props, forwardedRef) {
38
38
  {
39
39
  ...rest,
40
40
  contentContainerStyle,
41
- scrollIndicatorInsets,
42
- ref: forwardedRef
41
+ ref: forwardedRef,
42
+ scrollIndicatorInsets
43
43
  }
44
44
  )
45
45
  );
@@ -1,22 +1,22 @@
1
1
  'use strict';
2
2
 
3
- var list = require('@legendapp/list');
4
3
  var React = require('react');
5
4
  var Animated = require('react-native-reanimated');
5
+ var list = require('@legendapp/list');
6
6
 
7
7
  function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
8
8
 
9
9
  var React__default = /*#__PURE__*/_interopDefault(React);
10
10
  var Animated__default = /*#__PURE__*/_interopDefault(Animated);
11
11
 
12
- // src/reanimated.tsx
12
+ // src/integrations/reanimated.tsx
13
13
 
14
- // src/helpers.ts
14
+ // src/utils/helpers.ts
15
15
  function isFunction(obj) {
16
16
  return typeof obj === "function";
17
17
  }
18
18
 
19
- // src/useCombinedRef.ts
19
+ // src/hooks/useCombinedRef.ts
20
20
  var useCombinedRef = (...refs) => {
21
21
  const callback = React.useCallback((element) => {
22
22
  for (const ref of refs) {
@@ -33,16 +33,16 @@ var useCombinedRef = (...refs) => {
33
33
  return callback;
34
34
  };
35
35
 
36
- // src/reanimated.tsx
36
+ // src/integrations/reanimated.tsx
37
37
  var LegendListForwardedRef = React__default.default.forwardRef(function LegendListForwardedRef2(props, ref) {
38
38
  const { refLegendList, ...rest } = props;
39
39
  return /* @__PURE__ */ React__default.default.createElement(
40
40
  list.LegendList,
41
41
  {
42
- refScrollView: ref,
43
42
  ref: (r) => {
44
43
  refLegendList(r);
45
44
  },
45
+ refScrollView: ref,
46
46
  ...rest
47
47
  }
48
48
  );
@@ -52,7 +52,7 @@ var AnimatedLegendList = React__default.default.forwardRef(function AnimatedLege
52
52
  const { refScrollView, ...rest } = props;
53
53
  const refLegendList = React__default.default.useRef(null);
54
54
  const combinedRef = useCombinedRef(refLegendList, ref);
55
- return /* @__PURE__ */ React__default.default.createElement(AnimatedLegendListComponent, { refLegendList: combinedRef, ref: refScrollView, ...rest });
55
+ return /* @__PURE__ */ React__default.default.createElement(AnimatedLegendListComponent, { ref: refScrollView, refLegendList: combinedRef, ...rest });
56
56
  });
57
57
 
58
58
  exports.AnimatedLegendList = AnimatedLegendList;
@@ -1,15 +1,15 @@
1
- import { LegendList } from '@legendapp/list';
2
1
  import React, { useCallback } from 'react';
3
2
  import Animated from 'react-native-reanimated';
3
+ import { LegendList } from '@legendapp/list';
4
4
 
5
- // src/reanimated.tsx
5
+ // src/integrations/reanimated.tsx
6
6
 
7
- // src/helpers.ts
7
+ // src/utils/helpers.ts
8
8
  function isFunction(obj) {
9
9
  return typeof obj === "function";
10
10
  }
11
11
 
12
- // src/useCombinedRef.ts
12
+ // src/hooks/useCombinedRef.ts
13
13
  var useCombinedRef = (...refs) => {
14
14
  const callback = useCallback((element) => {
15
15
  for (const ref of refs) {
@@ -26,16 +26,16 @@ var useCombinedRef = (...refs) => {
26
26
  return callback;
27
27
  };
28
28
 
29
- // src/reanimated.tsx
29
+ // src/integrations/reanimated.tsx
30
30
  var LegendListForwardedRef = React.forwardRef(function LegendListForwardedRef2(props, ref) {
31
31
  const { refLegendList, ...rest } = props;
32
32
  return /* @__PURE__ */ React.createElement(
33
33
  LegendList,
34
34
  {
35
- refScrollView: ref,
36
35
  ref: (r) => {
37
36
  refLegendList(r);
38
37
  },
38
+ refScrollView: ref,
39
39
  ...rest
40
40
  }
41
41
  );
@@ -45,7 +45,7 @@ var AnimatedLegendList = React.forwardRef(function AnimatedLegendList2(props, re
45
45
  const { refScrollView, ...rest } = props;
46
46
  const refLegendList = React.useRef(null);
47
47
  const combinedRef = useCombinedRef(refLegendList, ref);
48
- return /* @__PURE__ */ React.createElement(AnimatedLegendListComponent, { refLegendList: combinedRef, ref: refScrollView, ...rest });
48
+ return /* @__PURE__ */ React.createElement(AnimatedLegendListComponent, { ref: refScrollView, refLegendList: combinedRef, ...rest });
49
49
  });
50
50
 
51
51
  export { AnimatedLegendList };
package/package.json CHANGED
@@ -1,89 +1,35 @@
1
1
  {
2
- "name": "@legendapp/list",
3
- "version": "2.0.0-next.2",
4
- "description": "Legend List is a drop-in replacement for FlatList with much better performance and supporting dynamically sized items.",
5
- "sideEffects": false,
6
- "private": false,
7
- "main": "./index.js",
8
- "module": "./index.mjs",
9
- "types": "./index.d.ts",
10
- "files": [
11
- "**"
12
- ],
13
- "exports": {
14
- "./package.json": "./package.json",
15
- ".": {
16
- "types": "./index.d.ts",
17
- "import": "./index.mjs",
18
- "require": "./index.js"
19
- },
20
- "./animated": {
21
- "types": "./animated.d.ts",
22
- "import": "./animated.mjs",
23
- "require": "./animated.js"
24
- },
25
- "./reanimated": {
26
- "types": "./reanimated.d.ts",
27
- "import": "./reanimated.mjs",
28
- "require": "./reanimated.js"
29
- },
30
- "./keyboard-controller": {
31
- "types": "./keyboard-controller.d.ts",
32
- "import": "./keyboard-controller.mjs",
33
- "require": "./keyboard-controller.js"
34
- }
35
- },
36
- "engines": {
37
- "node": ">=16.6.0",
38
- "npm": ">=8.11.0"
39
- },
40
- "scripts": {
41
- "build": "tsup && bun run posttsup.ts",
42
- "publish": "bun run build && cd dist && npm publish",
43
- "publish:next": "bun run build && cd dist && npm publish --tag next",
44
- "publish:beta": "bun run build && cd dist && npm publish --tag beta",
45
- "lint": "bunx biome check ./src && bunx biome format ./src && bun run lint:example",
46
- "lint:example": "bunx biome check ./example/app && bunx biome format ./example/app",
47
- "lint:fix": "bunx biome lint --write ./src && bunx biome format --write ./src && bunx biome check --write ./src && bun run lint:fix:example",
48
- "lint:fix:example": "bunx biome lint --write ./example/app && bunx biome format --write ./example/app && bunx biome check --write ./example/app"
49
- },
50
- "peerDependencies": {
51
- "react": "*",
52
- "react-native": "*"
53
- },
54
- "devDependencies": {
55
- "@biomejs/biome": "^1.9.4",
56
- "@types/bun": "^1.1.13",
57
- "@types/react": "^18.3.12",
58
- "@types/use-sync-external-store": "^1.5.0",
59
- "react": "^18.3.1",
60
- "react-native": "^0.76.2",
61
- "react-native-keyboard-controller": "^1.17.0",
62
- "react-native-reanimated": "^3.16.6",
63
- "tsup": "^8.3.5",
64
- "typescript": "^5.8.3"
65
- },
66
- "author": "Legend <contact@legendapp.com> (https://github.com/LegendApp)",
67
- "keywords": [
68
- "react",
69
- "react-native",
70
- "list"
71
- ],
72
- "repository": "github:LegendApp/legend-list",
73
- "license": "MIT",
74
- "bugs": {
75
- "url": "https://github.com/LegendApp/legend-list/issues"
76
- },
77
- "homepage": "https://github.com/LegendApp/legend-list#readme",
78
- "publishConfig": {
79
- "registry": "https://registry.npmjs.org/"
80
- },
81
- "commitlint": {
82
- "extends": [
83
- "@commitlint/config-conventional"
84
- ]
85
- },
86
- "dependencies": {
87
- "use-sync-external-store": "^1.5.0"
88
- }
89
- }
2
+ "name": "@legendapp/list",
3
+ "version": "2.0.0-next.4",
4
+ "description": "Legend List is a drop-in replacement for FlatList with much better performance and supporting dynamically sized items.",
5
+ "sideEffects": false,
6
+ "private": false,
7
+ "main": "./index.js",
8
+ "module": "./index.mjs",
9
+ "types": "./index.d.ts",
10
+ "files": [
11
+ "**"
12
+ ],
13
+ "peerDependencies": {
14
+ "react": "*",
15
+ "react-native": "*"
16
+ },
17
+ "author": "Legend <contact@legendapp.com> (https://github.com/LegendApp)",
18
+ "keywords": [
19
+ "react",
20
+ "react-native",
21
+ "list"
22
+ ],
23
+ "repository": "github:LegendApp/legend-list",
24
+ "license": "MIT",
25
+ "bugs": {
26
+ "url": "https://github.com/LegendApp/legend-list/issues"
27
+ },
28
+ "homepage": "https://github.com/LegendApp/legend-list#readme",
29
+ "publishConfig": {
30
+ "registry": "https://registry.npmjs.org/"
31
+ },
32
+ "dependencies": {
33
+ "use-sync-external-store": "^1.5.0"
34
+ }
35
+ }
@@ -1,8 +0,0 @@
1
- {
2
- "permissions": {
3
- "allow": [
4
- "Bash(bun run:*)"
5
- ],
6
- "deny": []
7
- }
8
- }
@@ -1,60 +0,0 @@
1
- ---
2
- description:
3
- globs: CHANGELOG.md
4
- alwaysApply: false
5
- ---
6
- # Changelog Update Rules
7
-
8
- ## Process for Adding Git Changes to Changelog
9
-
10
- When updating the changelog with recent git commits, follow these guidelines:
11
-
12
- ### 1. Identify Relevant Commits
13
- - Get all commits since the last version using: `git log --oneline --since="$(git log --grep="X.X.X" --format="%cd" --date=iso | head -1)" --reverse`
14
- - Exclude non-user-facing commits like:
15
- - "Update changelog"
16
- - "chore:" commits
17
- - Internal refactoring that doesn't affect API
18
- - "Refactor*" commits
19
-
20
- ### 2. Categorize Changes
21
- Organize changes by type with these prefixes, in this order:
22
- - **Feat:** New features and capabilities
23
- - **Fix:** Bug fixes and corrections
24
- - **Perf:** Performance improvements
25
- - **Improvement:** Enhancements to existing functionality
26
-
27
- Skip **Refactor:**, they don't need to be in the changelog
28
-
29
- ### 3. Format Guidelines
30
- - Write user-friendly descriptions, not raw commit messages
31
- - Focus on the impact/benefit to users
32
- - Be concise but descriptive
33
- - Use present tense ("Fix X" not "Fixed X")
34
- - Group similar changes together when possible
35
-
36
- ### 4. Version Organization
37
- - Add changes to the current version in package.json
38
- - If significant changes warrant a new version, bump version first
39
- - List most important changes (breaking changes, major features) first
40
- - Group fixes and minor improvements at the end
41
-
42
- ### 5. Example Format
43
- ```markdown
44
- ## X.X.X
45
- - Fix: [Issue description and impact]
46
- - Fix: [Another bug fix]
47
- - Feat: [New feature description]
48
- - Refactor: [API change description]
49
- - Perf: [Performance improvement description]
50
- - Improvement: [Enhancement description]
51
- ```
52
-
53
- ### 6. Quality Check
54
- - Ensure all user-facing changes are documented
55
- - Verify technical accuracy of descriptions
56
- - Check that breaking changes are clearly marked
57
- - Review for consistency in tone and format
58
-
59
- ### 7. Update package version
60
- If a specific version number is requested and it is newer than the version in package.json, update package.json
@@ -1,15 +0,0 @@
1
- # These are supported funding model platforms
2
-
3
- github: [jmeistrich]
4
- patreon: # Replace with a single Patreon username
5
- open_collective: # Replace with a single Open Collective username
6
- ko_fi: # Replace with a single Ko-fi username
7
- tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
8
- community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
9
- liberapay: # Replace with a single Liberapay username
10
- issuehunt: # Replace with a single IssueHunt username
11
- lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
12
- polar: # Replace with a single Polar username
13
- buy_me_a_coffee: # Replace with a single Buy Me a Coffee username
14
- thanks_dev: # Replace with a single thanks.dev username
15
- custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
package/.gitignore DELETED
@@ -1,5 +0,0 @@
1
- node_modules
2
- dist
3
- example/android
4
- example/ios
5
- legendapp-list.tgz
package/.prettierrc.json DELETED
@@ -1,5 +0,0 @@
1
- {
2
- "tabWidth": 4,
3
- "printWidth": 120,
4
- "singleQuote": true
5
- }
@@ -1,14 +0,0 @@
1
- {
2
- "editor.codeActionsOnSave": {
3
- "source.organizeImports.biome": "explicit",
4
- "quickfix.biome": "explicit"
5
- },
6
- "editor.defaultFormatter": "biomejs.biome",
7
- "[typescriptreact]": {
8
- "editor.defaultFormatter": "biomejs.biome"
9
- },
10
- "[typescript]": {
11
- "editor.defaultFormatter": "biomejs.biome"
12
- },
13
- "editor.formatOnSave": true
14
- }
package/CLAUDE.md DELETED
@@ -1,126 +0,0 @@
1
- # CLAUDE.md
2
-
3
- This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4
-
5
- ## Development Commands
6
-
7
- ### Build and Development
8
- - `bun run build` - Build the package using tsup and run post-build script
9
- - `bun run publish:manual` - Build and publish to npm manually
10
- - `bun run lint` - Check code formatting with Biome for src and example
11
- - `bun run lint:fix` - Auto-fix formatting issues with Biome for src and example
12
-
13
- ### Example App Development
14
- The repository includes a React Native example app in the `example/` directory:
15
- - `cd example && bun i && bun run ios` - Run the example app on iOS
16
- - Example app uses Expo and demonstrates various Legend List features
17
-
18
- ### Build Process
19
- - Uses tsup for TypeScript compilation with multiple entry points:
20
- - `src/index.ts` (main export)
21
- - `src/animated.tsx` (animated variant)
22
- - `src/reanimated.tsx` (reanimated variant)
23
- - `src/keyboard-controller.tsx` (keyboard integration)
24
- - Post-build script (`posttsup.ts`) copies LICENSE, CHANGELOG.md, README.md to dist and modifies package.json for publishing
25
- - Builds to both CommonJS and ESM formats with TypeScript declarations
26
-
27
- ## Architecture Overview
28
-
29
- Legend List is a high-performance React Native list component designed as a drop-in replacement for FlatList with better performance, especially for dynamically sized items.
30
-
31
- ### Core Components
32
-
33
- **LegendList** (`src/LegendList.tsx`): Main component that wraps functionality in a StateProvider
34
- - Handles virtualization logic, scroll management, and item positioning
35
- - Manages anchor elements for `maintainVisibleContentPosition`
36
- - Implements advanced scroll adjustment and jump prevention
37
- - Uses container recycling for optimal performance
38
-
39
- **State Management** (`src/state.tsx`): Global state management using observable patterns
40
- - Manages container positions, item data, and scroll state
41
- - Provides reactive updates to child components
42
-
43
- **Container System** (`src/Container.tsx`, `src/Containers.tsx`): Manages item rendering containers
44
- - Implements container recycling when `recycleItems` is enabled
45
- - Handles absolute positioning of list items
46
- - Manages container allocation and deallocation
47
-
48
- **Scroll Adjustment** (`src/ScrollAdjustHandler.ts`): Handles complex scroll position adjustments
49
- - Prevents scroll jumps when items are added/removed
50
- - Manages scroll position during layout changes
51
-
52
- ### Key Features Architecture
53
-
54
- **Dynamic Item Sizing**: Items can have varying heights without performance penalties
55
- - Uses `getEstimatedItemSize` or `estimatedItemSize` for initial estimates
56
- - Measures actual sizes on layout and adjusts total size calculations
57
- - Maintains position accuracy through size change events
58
-
59
- **Bidirectional Infinite Lists**: Supports infinite scrolling in both directions
60
- - `onStartReached` and `onEndReached` callbacks with configurable thresholds
61
- - Maintains scroll position when items are added to the beginning
62
-
63
- **Chat UI Support**:
64
- - `alignItemsAtEnd` aligns content to bottom for chat interfaces
65
- - `maintainScrollAtEnd` automatically scrolls to end when new items are added
66
- - Avoids need for inverted lists which cause animation issues
67
-
68
- **Column Support**: Multi-column layouts via `numColumns` prop
69
- - Manages row heights when items have different sizes within the same row
70
- - Handles column-aware positioning and gap calculations via `columnWrapperStyle`
71
-
72
- ### Performance Optimizations
73
-
74
- **Virtualization**: Only renders items in the visible area plus buffer zones
75
- - `drawDistance` controls how far ahead/behind to render items
76
- - Dynamic buffer adjustment based on scroll velocity
77
- - Container recycling to minimize React element creation/destruction
78
-
79
- **Scroll Jump Prevention**: Sophisticated system to prevent visual jumps
80
- - Anchor element tracking for `maintainVisibleContentPosition`
81
- - Scroll history tracking for velocity calculations
82
- - Position adjustment when item sizes change
83
-
84
- **Batched Updates**: Groups layout calculations to reduce renders
85
- - Uses `requestAnimationFrame` for batching size change calculations
86
- - Optimizes container position updates
87
-
88
- ## Integration Patterns
89
-
90
- ### Basic Usage
91
- Legend List is designed as a drop-in FlatList replacement:
92
- ```typescript
93
- <LegendList
94
- data={data}
95
- renderItem={renderItem}
96
- keyExtractor={(item) => item.id}
97
- recycleItems={true}
98
- />
99
- ```
100
-
101
- ### Optional Integrations
102
- - **Animated**: `@legendapp/list/animated` - Works with React Native Animated
103
- - **Reanimated**: `@legendapp/list/reanimated` - Works with React Native Reanimated
104
- - **Keyboard Controller**: `@legendapp/list/keyboard-controller` - Integrates with react-native-keyboard-controller
105
-
106
- ### Viewability Tracking
107
- Supports advanced viewability detection:
108
- - Compatible with FlatList's `viewabilityConfig` and `onViewableItemsChanged`
109
- - Custom hooks available: `useViewability`, `useViewabilityAmount`
110
-
111
- ## Important Development Notes
112
-
113
- - When working with container recycling (`recycleItems={true}`), be cautious about local state in item components
114
- - The `keyExtractor` is crucial for performance and correct behavior when data changes
115
- - Use `getEstimatedItemSize` for better performance with varying item sizes
116
- - The component uses advanced scroll position management that should not be interfered with directly
117
-
118
- ## Configuration Files
119
-
120
- - **Biome** (`biome.json`): Used for linting and formatting with specific rules for the project
121
- - **TypeScript** (`tsconfig.json`): Configured for React Native with path mappings for internal imports
122
- - **Cursor Rules**: `.cursor/rules/changelog.mdc` contains guidelines for maintaining the changelog
123
-
124
- ## Testing the Library
125
-
126
- To test changes, use the comprehensive example app which demonstrates various scenarios including dynamic sizing, infinite loading, chat interfaces, and performance comparisons with FlatList.