@shopify/flash-list 2.0.0-alpha.2 → 2.0.0-alpha.21

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 (329) hide show
  1. package/README.md +67 -96
  2. package/android/src/main/kotlin/com/shopify/reactnative/flash_list/BlankAreaEvent.kt +2 -2
  3. package/dist/AnimatedFlashList.d.ts +0 -1
  4. package/dist/AnimatedFlashList.d.ts.map +1 -1
  5. package/dist/AnimatedFlashList.js +3 -3
  6. package/dist/AnimatedFlashList.js.map +1 -1
  7. package/dist/FlashList.d.ts +9 -0
  8. package/dist/FlashList.d.ts.map +1 -1
  9. package/dist/FlashList.js +22 -3
  10. package/dist/FlashList.js.map +1 -1
  11. package/dist/FlashListProps.d.ts +33 -13
  12. package/dist/FlashListProps.d.ts.map +1 -1
  13. package/dist/FlashListProps.js.map +1 -1
  14. package/dist/FlashListRef.d.ts +305 -0
  15. package/dist/FlashListRef.d.ts.map +1 -0
  16. package/dist/FlashListRef.js +3 -0
  17. package/dist/FlashListRef.js.map +1 -0
  18. package/dist/GridLayoutProviderWithProps.js +1 -2
  19. package/dist/GridLayoutProviderWithProps.js.map +1 -1
  20. package/dist/MasonryFlashList.d.ts +2 -2
  21. package/dist/MasonryFlashList.d.ts.map +1 -1
  22. package/dist/MasonryFlashList.js.map +1 -1
  23. package/dist/PureComponentWrapper.js +1 -1
  24. package/dist/PureComponentWrapper.js.map +1 -1
  25. package/dist/__tests__/AverageWindow.test.js.map +1 -1
  26. package/dist/__tests__/ConsecutiveNumbers.test.d.ts +2 -0
  27. package/dist/__tests__/ConsecutiveNumbers.test.d.ts.map +1 -0
  28. package/dist/__tests__/ConsecutiveNumbers.test.js +224 -0
  29. package/dist/__tests__/ConsecutiveNumbers.test.js.map +1 -0
  30. package/dist/__tests__/FlashList.test.js.map +1 -1
  31. package/dist/__tests__/GridLayoutManager.test.d.ts +2 -0
  32. package/dist/__tests__/GridLayoutManager.test.d.ts.map +1 -0
  33. package/dist/__tests__/GridLayoutManager.test.js +69 -0
  34. package/dist/__tests__/GridLayoutManager.test.js.map +1 -0
  35. package/dist/__tests__/GridLayoutProviderWithProps.test.js.map +1 -1
  36. package/dist/__tests__/LayoutCommitObserver.test.d.ts +2 -0
  37. package/dist/__tests__/LayoutCommitObserver.test.d.ts.map +1 -0
  38. package/dist/__tests__/LayoutCommitObserver.test.js +35 -0
  39. package/dist/__tests__/LayoutCommitObserver.test.js.map +1 -0
  40. package/dist/__tests__/LinearLayoutManager.test.d.ts +2 -0
  41. package/dist/__tests__/LinearLayoutManager.test.d.ts.map +1 -0
  42. package/dist/__tests__/LinearLayoutManager.test.js +140 -0
  43. package/dist/__tests__/LinearLayoutManager.test.js.map +1 -0
  44. package/dist/__tests__/MasonryFlashList.test.js.map +1 -1
  45. package/dist/__tests__/MasonryLayoutManager.test.d.ts +2 -0
  46. package/dist/__tests__/MasonryLayoutManager.test.d.ts.map +1 -0
  47. package/dist/__tests__/MasonryLayoutManager.test.js +148 -0
  48. package/dist/__tests__/MasonryLayoutManager.test.js.map +1 -0
  49. package/dist/__tests__/RecyclerView.test.d.ts +2 -0
  50. package/dist/__tests__/RecyclerView.test.d.ts.map +1 -0
  51. package/dist/__tests__/RecyclerView.test.js +103 -0
  52. package/dist/__tests__/RecyclerView.test.js.map +1 -0
  53. package/dist/__tests__/RenderStackManager.test.d.ts +2 -0
  54. package/dist/__tests__/RenderStackManager.test.d.ts.map +1 -0
  55. package/dist/__tests__/RenderStackManager.test.js +485 -0
  56. package/dist/__tests__/RenderStackManager.test.js.map +1 -0
  57. package/dist/__tests__/ViewabilityHelper.test.js.map +1 -1
  58. package/dist/__tests__/findVisibleIndex.test.d.ts +2 -0
  59. package/dist/__tests__/findVisibleIndex.test.d.ts.map +1 -0
  60. package/dist/__tests__/findVisibleIndex.test.js +259 -0
  61. package/dist/__tests__/findVisibleIndex.test.js.map +1 -0
  62. package/dist/__tests__/helpers/createLayoutManager.d.ts +34 -0
  63. package/dist/__tests__/helpers/createLayoutManager.d.ts.map +1 -0
  64. package/dist/__tests__/helpers/createLayoutManager.js +110 -0
  65. package/dist/__tests__/helpers/createLayoutManager.js.map +1 -0
  66. package/dist/__tests__/helpers/mountFlashList.d.ts +2 -2
  67. package/dist/__tests__/helpers/mountFlashList.d.ts.map +1 -1
  68. package/dist/__tests__/helpers/mountFlashList.js +2 -2
  69. package/dist/__tests__/helpers/mountFlashList.js.map +1 -1
  70. package/dist/__tests__/helpers/mountMasonryFlashList.d.ts +2 -2
  71. package/dist/__tests__/helpers/mountMasonryFlashList.d.ts.map +1 -1
  72. package/dist/__tests__/helpers/mountMasonryFlashList.js +2 -2
  73. package/dist/__tests__/helpers/mountMasonryFlashList.js.map +1 -1
  74. package/dist/__tests__/useBlankAreaTracker.test.js.map +1 -1
  75. package/dist/__tests__/useUnmountAwareCallbacks.test.d.ts +2 -0
  76. package/dist/__tests__/useUnmountAwareCallbacks.test.d.ts.map +1 -0
  77. package/dist/__tests__/useUnmountAwareCallbacks.test.js +185 -0
  78. package/dist/__tests__/useUnmountAwareCallbacks.test.js.map +1 -0
  79. package/dist/benchmark/AutoScrollHelper.js +2 -2
  80. package/dist/benchmark/AutoScrollHelper.js.map +1 -1
  81. package/dist/benchmark/JSFPSMonitor.js.map +1 -1
  82. package/dist/benchmark/roundToDecimalPlaces.js +1 -2
  83. package/dist/benchmark/roundToDecimalPlaces.js.map +1 -1
  84. package/dist/benchmark/useBenchmark.js +2 -28
  85. package/dist/benchmark/useBenchmark.js.map +1 -1
  86. package/dist/benchmark/useBlankAreaTracker.js +1 -2
  87. package/dist/benchmark/useBlankAreaTracker.js.map +1 -1
  88. package/dist/benchmark/useDataMultiplier.js +1 -2
  89. package/dist/benchmark/useDataMultiplier.js.map +1 -1
  90. package/dist/benchmark/useFlatListBenchmark.d.ts +0 -1
  91. package/dist/benchmark/useFlatListBenchmark.d.ts.map +1 -1
  92. package/dist/benchmark/useFlatListBenchmark.js +9 -9
  93. package/dist/benchmark/useFlatListBenchmark.js.map +1 -1
  94. package/dist/enableNewCore.d.ts.map +1 -1
  95. package/dist/enableNewCore.js +4 -4
  96. package/dist/enableNewCore.js.map +1 -1
  97. package/dist/errors/CustomError.js.map +1 -1
  98. package/dist/index.d.ts +4 -1
  99. package/dist/index.d.ts.map +1 -1
  100. package/dist/index.js +11 -3
  101. package/dist/index.js.map +1 -1
  102. package/dist/native/auto-layout/AutoLayoutView.d.ts +1 -1
  103. package/dist/native/auto-layout/AutoLayoutView.d.ts.map +1 -1
  104. package/dist/native/auto-layout/AutoLayoutView.js +1 -1
  105. package/dist/native/auto-layout/AutoLayoutView.js.map +1 -1
  106. package/dist/native/auto-layout/AutoLayoutViewNativeComponent.d.ts.map +1 -1
  107. package/dist/native/auto-layout/AutoLayoutViewNativeComponentProps.d.ts +1 -1
  108. package/dist/native/auto-layout/AutoLayoutViewNativeComponentProps.d.ts.map +1 -1
  109. package/dist/native/config/PlatformHelper.android.d.ts +2 -0
  110. package/dist/native/config/PlatformHelper.android.d.ts.map +1 -1
  111. package/dist/native/config/PlatformHelper.android.js +2 -0
  112. package/dist/native/config/PlatformHelper.android.js.map +1 -1
  113. package/dist/native/config/PlatformHelper.d.ts +2 -0
  114. package/dist/native/config/PlatformHelper.d.ts.map +1 -1
  115. package/dist/native/config/PlatformHelper.ios.d.ts +2 -0
  116. package/dist/native/config/PlatformHelper.ios.d.ts.map +1 -1
  117. package/dist/native/config/PlatformHelper.ios.js +2 -0
  118. package/dist/native/config/PlatformHelper.ios.js.map +1 -1
  119. package/dist/native/config/PlatformHelper.js +2 -0
  120. package/dist/native/config/PlatformHelper.js.map +1 -1
  121. package/dist/native/config/PlatformHelper.web.d.ts +2 -0
  122. package/dist/native/config/PlatformHelper.web.d.ts.map +1 -1
  123. package/dist/native/config/PlatformHelper.web.js +3 -1
  124. package/dist/native/config/PlatformHelper.web.js.map +1 -1
  125. package/dist/recyclerview/LayoutCommitObserver.d.ts +12 -0
  126. package/dist/recyclerview/LayoutCommitObserver.d.ts.map +1 -0
  127. package/dist/recyclerview/LayoutCommitObserver.js +62 -0
  128. package/dist/recyclerview/LayoutCommitObserver.js.map +1 -0
  129. package/dist/recyclerview/RecyclerView.d.ts +3 -2
  130. package/dist/recyclerview/RecyclerView.d.ts.map +1 -1
  131. package/dist/recyclerview/RecyclerView.js +133 -69
  132. package/dist/recyclerview/RecyclerView.js.map +1 -1
  133. package/dist/recyclerview/RecyclerViewContextProvider.d.ts +41 -7
  134. package/dist/recyclerview/RecyclerViewContextProvider.d.ts.map +1 -1
  135. package/dist/recyclerview/RecyclerViewContextProvider.js +6 -2
  136. package/dist/recyclerview/RecyclerViewContextProvider.js.map +1 -1
  137. package/dist/recyclerview/RecyclerViewManager.d.ts +31 -7
  138. package/dist/recyclerview/RecyclerViewManager.d.ts.map +1 -1
  139. package/dist/recyclerview/RecyclerViewManager.js +154 -117
  140. package/dist/recyclerview/RecyclerViewManager.js.map +1 -1
  141. package/dist/recyclerview/RecyclerViewProps.d.ts +1 -1
  142. package/dist/recyclerview/RecyclerViewProps.d.ts.map +1 -1
  143. package/dist/recyclerview/RenderStackManager.d.ts +86 -0
  144. package/dist/recyclerview/RenderStackManager.d.ts.map +1 -0
  145. package/dist/recyclerview/RenderStackManager.js +343 -0
  146. package/dist/recyclerview/RenderStackManager.js.map +1 -0
  147. package/dist/recyclerview/ViewHolder.d.ts.map +1 -1
  148. package/dist/recyclerview/ViewHolder.js +8 -6
  149. package/dist/recyclerview/ViewHolder.js.map +1 -1
  150. package/dist/recyclerview/ViewHolderCollection.d.ts +10 -4
  151. package/dist/recyclerview/ViewHolderCollection.d.ts.map +1 -1
  152. package/dist/recyclerview/ViewHolderCollection.js +26 -10
  153. package/dist/recyclerview/ViewHolderCollection.js.map +1 -1
  154. package/dist/recyclerview/components/ScrollAnchor.d.ts +2 -1
  155. package/dist/recyclerview/components/ScrollAnchor.d.ts.map +1 -1
  156. package/dist/recyclerview/components/ScrollAnchor.js +12 -9
  157. package/dist/recyclerview/components/ScrollAnchor.js.map +1 -1
  158. package/dist/recyclerview/components/StickyHeaders.d.ts +2 -2
  159. package/dist/recyclerview/components/StickyHeaders.d.ts.map +1 -1
  160. package/dist/recyclerview/components/StickyHeaders.js +44 -45
  161. package/dist/recyclerview/components/StickyHeaders.js.map +1 -1
  162. package/dist/recyclerview/helpers/ConsecutiveNumbers.d.ts +1 -1
  163. package/dist/recyclerview/helpers/ConsecutiveNumbers.d.ts.map +1 -1
  164. package/dist/recyclerview/helpers/ConsecutiveNumbers.js +2 -2
  165. package/dist/recyclerview/helpers/ConsecutiveNumbers.js.map +1 -1
  166. package/dist/recyclerview/helpers/EngagedIndicesTracker.d.ts +48 -2
  167. package/dist/recyclerview/helpers/EngagedIndicesTracker.d.ts.map +1 -1
  168. package/dist/recyclerview/helpers/EngagedIndicesTracker.js +89 -19
  169. package/dist/recyclerview/helpers/EngagedIndicesTracker.js.map +1 -1
  170. package/dist/recyclerview/helpers/RenderTimeTracker.d.ts +11 -0
  171. package/dist/recyclerview/helpers/RenderTimeTracker.d.ts.map +1 -0
  172. package/dist/recyclerview/helpers/RenderTimeTracker.js +42 -0
  173. package/dist/recyclerview/helpers/RenderTimeTracker.js.map +1 -0
  174. package/dist/recyclerview/helpers/VelocityTracker.d.ts +29 -0
  175. package/dist/recyclerview/helpers/VelocityTracker.d.ts.map +1 -0
  176. package/dist/recyclerview/helpers/VelocityTracker.js +70 -0
  177. package/dist/recyclerview/helpers/VelocityTracker.js.map +1 -0
  178. package/dist/recyclerview/hooks/useBoundDetection.d.ts +1 -3
  179. package/dist/recyclerview/hooks/useBoundDetection.d.ts.map +1 -1
  180. package/dist/recyclerview/hooks/useBoundDetection.js +60 -28
  181. package/dist/recyclerview/hooks/useBoundDetection.js.map +1 -1
  182. package/dist/recyclerview/hooks/useLayoutState.d.ts +3 -1
  183. package/dist/recyclerview/hooks/useLayoutState.d.ts.map +1 -1
  184. package/dist/recyclerview/hooks/useLayoutState.js +6 -5
  185. package/dist/recyclerview/hooks/useLayoutState.js.map +1 -1
  186. package/dist/recyclerview/hooks/useMappingHelper.d.ts +9 -0
  187. package/dist/recyclerview/hooks/useMappingHelper.d.ts.map +1 -0
  188. package/dist/recyclerview/hooks/useMappingHelper.js +19 -0
  189. package/dist/recyclerview/hooks/useMappingHelper.js.map +1 -0
  190. package/dist/recyclerview/hooks/useOnLoad.d.ts +2 -2
  191. package/dist/recyclerview/hooks/useOnLoad.d.ts.map +1 -1
  192. package/dist/recyclerview/hooks/useOnLoad.js +9 -10
  193. package/dist/recyclerview/hooks/useOnLoad.js.map +1 -1
  194. package/dist/recyclerview/hooks/useRecyclerViewController.d.ts +5 -49
  195. package/dist/recyclerview/hooks/useRecyclerViewController.d.ts.map +1 -1
  196. package/dist/recyclerview/hooks/useRecyclerViewController.js +343 -191
  197. package/dist/recyclerview/hooks/useRecyclerViewController.js.map +1 -1
  198. package/dist/recyclerview/hooks/useRecyclerViewManager.d.ts +2 -0
  199. package/dist/recyclerview/hooks/useRecyclerViewManager.d.ts.map +1 -1
  200. package/dist/recyclerview/hooks/useRecyclerViewManager.js +11 -1
  201. package/dist/recyclerview/hooks/useRecyclerViewManager.js.map +1 -1
  202. package/dist/recyclerview/hooks/useRecyclingState.d.ts +4 -2
  203. package/dist/recyclerview/hooks/useRecyclingState.d.ts.map +1 -1
  204. package/dist/recyclerview/hooks/useRecyclingState.js +3 -4
  205. package/dist/recyclerview/hooks/useRecyclingState.js.map +1 -1
  206. package/dist/recyclerview/hooks/useSecondaryProps.d.ts +1 -1
  207. package/dist/recyclerview/hooks/useSecondaryProps.d.ts.map +1 -1
  208. package/dist/recyclerview/hooks/useSecondaryProps.js +15 -12
  209. package/dist/recyclerview/hooks/useSecondaryProps.js.map +1 -1
  210. package/dist/recyclerview/hooks/useUnmountAwareCallbacks.d.ts +15 -0
  211. package/dist/recyclerview/hooks/useUnmountAwareCallbacks.d.ts.map +1 -0
  212. package/dist/recyclerview/hooks/useUnmountAwareCallbacks.js +63 -0
  213. package/dist/recyclerview/hooks/useUnmountAwareCallbacks.js.map +1 -0
  214. package/dist/recyclerview/hooks/useUnmountFlag.d.ts +0 -1
  215. package/dist/recyclerview/hooks/useUnmountFlag.d.ts.map +1 -1
  216. package/dist/recyclerview/hooks/useUnmountFlag.js +1 -0
  217. package/dist/recyclerview/hooks/useUnmountFlag.js.map +1 -1
  218. package/dist/recyclerview/layout-managers/GridLayoutManager.d.ts +18 -4
  219. package/dist/recyclerview/layout-managers/GridLayoutManager.d.ts.map +1 -1
  220. package/dist/recyclerview/layout-managers/GridLayoutManager.js +61 -25
  221. package/dist/recyclerview/layout-managers/GridLayoutManager.js.map +1 -1
  222. package/dist/recyclerview/layout-managers/LayoutManager.d.ts +36 -21
  223. package/dist/recyclerview/layout-managers/LayoutManager.d.ts.map +1 -1
  224. package/dist/recyclerview/layout-managers/LayoutManager.js +96 -28
  225. package/dist/recyclerview/layout-managers/LayoutManager.js.map +1 -1
  226. package/dist/recyclerview/layout-managers/LinearLayoutManager.d.ts +1 -2
  227. package/dist/recyclerview/layout-managers/LinearLayoutManager.d.ts.map +1 -1
  228. package/dist/recyclerview/layout-managers/LinearLayoutManager.js +3 -3
  229. package/dist/recyclerview/layout-managers/LinearLayoutManager.js.map +1 -1
  230. package/dist/recyclerview/layout-managers/MasonryLayoutManager.d.ts +9 -1
  231. package/dist/recyclerview/layout-managers/MasonryLayoutManager.d.ts.map +1 -1
  232. package/dist/recyclerview/layout-managers/MasonryLayoutManager.js +30 -16
  233. package/dist/recyclerview/layout-managers/MasonryLayoutManager.js.map +1 -1
  234. package/dist/recyclerview/utils/adjustOffsetForRTL.js +1 -2
  235. package/dist/recyclerview/utils/adjustOffsetForRTL.js.map +1 -1
  236. package/dist/recyclerview/utils/componentUtils.d.ts +1 -1
  237. package/dist/recyclerview/utils/componentUtils.d.ts.map +1 -1
  238. package/dist/recyclerview/utils/componentUtils.js.map +1 -1
  239. package/dist/recyclerview/utils/findVisibleIndex.d.ts.map +1 -1
  240. package/dist/recyclerview/utils/findVisibleIndex.js +3 -5
  241. package/dist/recyclerview/utils/findVisibleIndex.js.map +1 -1
  242. package/dist/recyclerview/utils/measureLayout.d.ts +24 -28
  243. package/dist/recyclerview/utils/measureLayout.d.ts.map +1 -1
  244. package/dist/recyclerview/utils/measureLayout.js +36 -6
  245. package/dist/recyclerview/utils/measureLayout.js.map +1 -1
  246. package/dist/recyclerview/utils/measureLayout.web.d.ts +29 -0
  247. package/dist/recyclerview/utils/measureLayout.web.d.ts.map +1 -0
  248. package/dist/recyclerview/utils/measureLayout.web.js +87 -0
  249. package/dist/recyclerview/utils/measureLayout.web.js.map +1 -0
  250. package/dist/specs/AutoLayoutNativeComponent.d.ts +1 -2
  251. package/dist/specs/AutoLayoutNativeComponent.d.ts.map +1 -1
  252. package/dist/specs/CellContainerNativeComponent.d.ts +0 -1
  253. package/dist/specs/CellContainerNativeComponent.d.ts.map +1 -1
  254. package/dist/tsconfig.tsbuildinfo +1 -1
  255. package/dist/utils/AverageWindow.js.map +1 -1
  256. package/dist/utils/ContentContainerUtils.d.ts.map +1 -1
  257. package/dist/utils/ContentContainerUtils.js.map +1 -1
  258. package/dist/viewability/ViewToken.d.ts +2 -2
  259. package/dist/viewability/ViewToken.d.ts.map +1 -1
  260. package/dist/viewability/ViewabilityHelper.js +1 -1
  261. package/dist/viewability/ViewabilityHelper.js.map +1 -1
  262. package/dist/viewability/ViewabilityManager.d.ts.map +1 -1
  263. package/dist/viewability/ViewabilityManager.js +11 -5
  264. package/dist/viewability/ViewabilityManager.js.map +1 -1
  265. package/jestSetup.js +30 -11
  266. package/package.json +4 -3
  267. package/src/AnimatedFlashList.ts +3 -2
  268. package/src/FlashList.tsx +25 -1
  269. package/src/FlashListProps.ts +42 -11
  270. package/src/FlashListRef.ts +320 -0
  271. package/src/MasonryFlashList.tsx +2 -2
  272. package/src/__tests__/ConsecutiveNumbers.test.ts +232 -0
  273. package/src/__tests__/GridLayoutManager.test.ts +113 -0
  274. package/src/__tests__/LayoutCommitObserver.test.tsx +60 -0
  275. package/src/__tests__/LinearLayoutManager.test.ts +227 -0
  276. package/src/__tests__/MasonryLayoutManager.test.ts +202 -0
  277. package/src/__tests__/RecyclerView.test.tsx +144 -0
  278. package/src/__tests__/RenderStackManager.test.ts +574 -0
  279. package/src/__tests__/findVisibleIndex.test.ts +369 -0
  280. package/src/__tests__/helpers/createLayoutManager.ts +141 -0
  281. package/src/__tests__/useUnmountAwareCallbacks.test.tsx +285 -0
  282. package/src/benchmark/useBenchmark.ts +0 -37
  283. package/src/benchmark/useFlatListBenchmark.ts +2 -2
  284. package/src/enableNewCore.ts +3 -1
  285. package/src/index.ts +14 -3
  286. package/src/native/config/PlatformHelper.android.ts +2 -0
  287. package/src/native/config/PlatformHelper.ios.ts +2 -0
  288. package/src/native/config/PlatformHelper.ts +2 -0
  289. package/src/native/config/PlatformHelper.web.ts +3 -1
  290. package/src/recyclerview/LayoutCommitObserver.tsx +74 -0
  291. package/src/recyclerview/RecyclerView.tsx +178 -89
  292. package/src/recyclerview/RecyclerViewContextProvider.ts +53 -7
  293. package/src/recyclerview/RecyclerViewManager.ts +176 -97
  294. package/src/recyclerview/RecyclerViewProps.ts +2 -1
  295. package/src/recyclerview/RenderStackManager.ts +317 -0
  296. package/src/recyclerview/ViewHolder.tsx +13 -6
  297. package/src/recyclerview/ViewHolderCollection.tsx +45 -16
  298. package/src/recyclerview/components/ScrollAnchor.tsx +24 -11
  299. package/src/recyclerview/components/StickyHeaders.tsx +70 -58
  300. package/src/recyclerview/helpers/ConsecutiveNumbers.ts +2 -2
  301. package/src/recyclerview/helpers/EngagedIndicesTracker.ts +135 -25
  302. package/src/recyclerview/helpers/RenderTimeTracker.ts +42 -0
  303. package/src/recyclerview/helpers/VelocityTracker.ts +77 -0
  304. package/src/recyclerview/hooks/useBoundDetection.ts +74 -25
  305. package/src/recyclerview/hooks/useLayoutState.ts +15 -6
  306. package/src/recyclerview/hooks/useMappingHelper.ts +20 -0
  307. package/src/recyclerview/hooks/useOnLoad.ts +11 -10
  308. package/src/recyclerview/hooks/useRecyclerViewController.tsx +380 -241
  309. package/src/recyclerview/hooks/useRecyclerViewManager.ts +13 -1
  310. package/src/recyclerview/hooks/useRecyclingState.ts +11 -7
  311. package/src/recyclerview/hooks/useSecondaryProps.tsx +12 -7
  312. package/src/recyclerview/hooks/useUnmountAwareCallbacks.ts +73 -0
  313. package/src/recyclerview/hooks/useUnmountFlag.ts +1 -0
  314. package/src/recyclerview/layout-managers/GridLayoutManager.ts +68 -27
  315. package/src/recyclerview/layout-managers/LayoutManager.ts +116 -42
  316. package/src/recyclerview/layout-managers/LinearLayoutManager.ts +12 -8
  317. package/src/recyclerview/layout-managers/MasonryLayoutManager.ts +34 -13
  318. package/src/recyclerview/utils/componentUtils.ts +1 -1
  319. package/src/recyclerview/utils/findVisibleIndex.ts +1 -2
  320. package/src/recyclerview/utils/measureLayout.ts +41 -2
  321. package/src/recyclerview/utils/measureLayout.web.ts +102 -0
  322. package/src/viewability/ViewToken.ts +2 -2
  323. package/src/viewability/ViewabilityHelper.ts +1 -1
  324. package/src/viewability/ViewabilityManager.ts +16 -9
  325. package/dist/recyclerview/RecycleKeyManager.d.ts +0 -82
  326. package/dist/recyclerview/RecycleKeyManager.d.ts.map +0 -1
  327. package/dist/recyclerview/RecycleKeyManager.js +0 -135
  328. package/dist/recyclerview/RecycleKeyManager.js.map +0 -1
  329. package/src/recyclerview/RecycleKeyManager.ts +0 -185
@@ -19,11 +19,14 @@ import {
19
19
  NativeSyntheticEvent,
20
20
  } from "react-native";
21
21
 
22
+ import { FlashListRef } from "../FlashListRef";
23
+
22
24
  import { RVDimension } from "./layout-managers/LayoutManager";
23
25
  import {
24
26
  areDimensionsNotEqual,
25
- measureLayout,
26
- measureLayoutRelative,
27
+ measureFirstChildLayout,
28
+ measureItemLayout,
29
+ measureParentSize,
27
30
  } from "./utils/measureLayout";
28
31
  import {
29
32
  RecyclerViewContext,
@@ -46,6 +49,7 @@ import { useSecondaryProps } from "./hooks/useSecondaryProps";
46
49
  import { StickyHeaders, StickyHeaderRef } from "./components/StickyHeaders";
47
50
  import { ScrollAnchor, ScrollAnchorRef } from "./components/ScrollAnchor";
48
51
  import { useRecyclerViewController } from "./hooks/useRecyclerViewController";
52
+ import { RenderTimeTracker } from "./helpers/RenderTimeTracker";
49
53
 
50
54
  /**
51
55
  * Main RecyclerView component that handles list rendering, scrolling, and item recycling.
@@ -53,7 +57,7 @@ import { useRecyclerViewController } from "./hooks/useRecyclerViewController";
53
57
  */
54
58
  const RecyclerViewComponent = <T,>(
55
59
  props: RecyclerViewProps<T>,
56
- ref: React.Ref<any>
60
+ ref: React.Ref<FlashListRef<T>>
57
61
  ) => {
58
62
  // Destructure props and initialize refs
59
63
  const {
@@ -74,8 +78,6 @@ const RecyclerViewComponent = <T,>(
74
78
  ListFooterComponentStyle,
75
79
  ItemSeparatorComponent,
76
80
  renderScrollComponent,
77
- onScroll,
78
- disableRecycling,
79
81
  style,
80
82
  stickyHeaderIndices,
81
83
  maintainVisibleContentPosition,
@@ -83,10 +85,14 @@ const RecyclerViewComponent = <T,>(
83
85
  ...rest
84
86
  } = props;
85
87
 
88
+ const [renderTimeTracker] = useState(() => new RenderTimeTracker());
89
+
90
+ renderTimeTracker.startTracking();
91
+
86
92
  // Core refs for managing scroll view, internal view, and child container
87
93
  const scrollViewRef = useRef<CompatScroller>(null);
88
94
  const internalViewRef = useRef<CompatView>(null);
89
- const childContainerViewRef = useRef<CompatView>(null);
95
+ const firstChildViewRef = useRef<CompatView>(null);
90
96
  const containerViewSizeRef = useRef<RVDimension | undefined>(undefined);
91
97
  const pendingChildIds = useRef<Set<string>>(new Set()).current;
92
98
 
@@ -108,15 +114,19 @@ const RecyclerViewComponent = <T,>(
108
114
  );
109
115
 
110
116
  // Initialize core RecyclerView manager and content offset management
111
- const { recyclerViewManager } = useRecyclerViewManager(props);
112
- const { applyContentOffset, applyInitialScrollIndex } =
113
- useRecyclerViewController(
114
- recyclerViewManager,
115
- ref,
116
- scrollViewRef,
117
- scrollAnchorRef,
118
- props
119
- );
117
+ const { recyclerViewManager, velocityTracker } =
118
+ useRecyclerViewManager(props);
119
+ const {
120
+ applyOffsetCorrection,
121
+ computeFirstVisibleIndexForOffsetCorrection,
122
+ applyInitialScrollIndex,
123
+ handlerMethods,
124
+ } = useRecyclerViewController(
125
+ recyclerViewManager,
126
+ ref,
127
+ scrollViewRef,
128
+ scrollAnchorRef
129
+ );
120
130
 
121
131
  // Initialize view holder collection ref
122
132
  const viewHolderCollectionRef = useRef<ViewHolderCollectionRef>(null);
@@ -125,40 +135,44 @@ const RecyclerViewComponent = <T,>(
125
135
  useOnListLoad(recyclerViewManager, onLoad);
126
136
 
127
137
  // Hook to detect when scrolling reaches list bounds
128
- const { checkBounds } = useBoundDetection(
129
- recyclerViewManager,
130
- props,
131
- scrollViewRef
132
- );
138
+ const { checkBounds } = useBoundDetection(recyclerViewManager, scrollViewRef);
139
+
140
+ const isHorizontalRTL = I18nManager.isRTL && horizontal;
133
141
 
134
142
  /**
135
143
  * Initialize the RecyclerView by measuring and setting up the window size
136
144
  * This effect runs when the component mounts or when layout changes
137
145
  */
138
146
  useLayoutEffect(() => {
139
- if (internalViewRef.current && childContainerViewRef.current) {
147
+ if (internalViewRef.current && firstChildViewRef.current) {
140
148
  // Measure the outer and inner container layouts
141
- const outerViewLayout = measureLayout(internalViewRef.current, undefined);
142
- const childViewLayout = measureLayoutRelative(
143
- childContainerViewRef.current,
144
- internalViewRef.current,
145
- undefined
149
+ const outerViewLayout = measureParentSize(internalViewRef.current);
150
+ const firstChildViewLayout = measureFirstChildLayout(
151
+ firstChildViewRef.current,
152
+ internalViewRef.current
146
153
  );
147
154
 
148
155
  containerViewSizeRef.current = outerViewLayout;
149
156
 
150
157
  // Calculate offset of first item
151
158
  const firstItemOffset = horizontal
152
- ? childViewLayout.x - outerViewLayout.x
153
- : childViewLayout.y - outerViewLayout.y;
159
+ ? firstChildViewLayout.x - outerViewLayout.x
160
+ : firstChildViewLayout.y - outerViewLayout.y;
154
161
 
155
162
  // Update the RecyclerView manager with window dimensions
156
163
  recyclerViewManager.updateLayoutParams(
157
164
  {
158
- width: horizontal ? outerViewLayout.width : childViewLayout.width,
159
- height: horizontal ? childViewLayout.height : outerViewLayout.height,
165
+ width: horizontal
166
+ ? outerViewLayout.width
167
+ : firstChildViewLayout.width,
168
+ height: horizontal
169
+ ? firstChildViewLayout.height
170
+ : outerViewLayout.height,
160
171
  },
161
- firstItemOffset
172
+ isHorizontalRTL && recyclerViewManager.hasLayout()
173
+ ? firstItemOffset -
174
+ recyclerViewManager.getChildContainerDimensions().width
175
+ : firstItemOffset
162
176
  );
163
177
  }
164
178
  });
@@ -167,18 +181,19 @@ const RecyclerViewComponent = <T,>(
167
181
  * Effect to handle layout updates for list items
168
182
  * This ensures proper positioning and recycling of items
169
183
  */
184
+ // eslint-disable-next-line react-hooks/exhaustive-deps
170
185
  useLayoutEffect(() => {
171
186
  if (pendingChildIds.size > 0) {
172
187
  return;
173
188
  }
174
189
  const layoutInfo = Array.from(refHolder, ([index, viewHolderRef]) => {
175
- const layout = measureLayout(
190
+ const layout = measureItemLayout(
176
191
  viewHolderRef.current!,
177
- recyclerViewManager.getLayout(index)
192
+ recyclerViewManager.tryGetLayout(index)
178
193
  );
179
194
 
180
- //comapre height with stored layout
181
- //const storedLayout = recyclerViewManager.getLayout(index);
195
+ // comapre height with stored layout
196
+ // const storedLayout = recyclerViewManager.getLayout(index);
182
197
  // if (
183
198
  // storedLayout.height !== layout.height &&
184
199
  // storedLayout.isHeightMeasured
@@ -199,10 +214,8 @@ const RecyclerViewComponent = <T,>(
199
214
  // Trigger re-render if layout modifications were made
200
215
  setRenderId((prev) => prev + 1);
201
216
  } else {
202
- //console.log("commitLayout");
203
- // TODO: reduce perf impact of commitLayout
204
217
  viewHolderCollectionRef.current?.commitLayout();
205
- applyContentOffset();
218
+ applyOffsetCorrection();
206
219
  }
207
220
  });
208
221
 
@@ -211,30 +224,45 @@ const RecyclerViewComponent = <T,>(
211
224
  */
212
225
  const onScrollHandler = useCallback(
213
226
  (event: NativeSyntheticEvent<NativeScrollEvent>) => {
214
- let velocity = event.nativeEvent.velocity;
227
+ if (recyclerViewManager.ignoreScrollEvents) {
228
+ return;
229
+ }
230
+
215
231
  let scrollOffset = horizontal
216
232
  ? event.nativeEvent.contentOffset.x
217
233
  : event.nativeEvent.contentOffset.y;
218
234
 
219
235
  // Handle RTL (Right-to-Left) layout adjustments
220
- if (I18nManager.isRTL && horizontal) {
236
+ if (isHorizontalRTL) {
221
237
  scrollOffset = adjustOffsetForRTL(
222
238
  scrollOffset,
223
239
  event.nativeEvent.contentSize.width,
224
240
  event.nativeEvent.layoutMeasurement.width
225
241
  );
226
- if (velocity) {
227
- velocity = {
228
- x: -velocity.x,
229
- y: velocity.y,
230
- };
231
- }
232
242
  }
233
243
 
234
- // Update scroll position and trigger re-render if needed
235
- if (recyclerViewManager.updateScrollOffset(scrollOffset, velocity)) {
236
- setRenderId((prev) => prev + 1);
237
- }
244
+ velocityTracker.computeVelocity(
245
+ scrollOffset,
246
+ recyclerViewManager.getAbsoluteLastScrollOffset(),
247
+ Boolean(horizontal),
248
+ (velocity, isMomentumEnd) => {
249
+ if (recyclerViewManager.ignoreScrollEvents) {
250
+ return;
251
+ }
252
+
253
+ if (isMomentumEnd) {
254
+ computeFirstVisibleIndexForOffsetCorrection();
255
+ if (!recyclerViewManager.isOffsetProjectionEnabled) {
256
+ return;
257
+ }
258
+ recyclerViewManager.resetVelocityCompute();
259
+ }
260
+ // Update scroll position and trigger re-render if needed
261
+ if (recyclerViewManager.updateScrollOffset(scrollOffset, velocity)) {
262
+ setRenderId((prev) => prev + 1);
263
+ }
264
+ }
265
+ );
238
266
 
239
267
  // Update sticky headers and check bounds
240
268
  stickyHeaderRef.current?.reportScrollEvent(event.nativeEvent);
@@ -245,22 +273,41 @@ const RecyclerViewComponent = <T,>(
245
273
  recyclerViewManager.computeItemViewability();
246
274
 
247
275
  // Call user-provided onScroll handler
248
- onScroll?.(event);
276
+ recyclerViewManager.props.onScroll?.(event);
249
277
  },
250
- [horizontal, recyclerViewManager]
278
+ [
279
+ checkBounds,
280
+ computeFirstVisibleIndexForOffsetCorrection,
281
+ horizontal,
282
+ isHorizontalRTL,
283
+ recyclerViewManager,
284
+ velocityTracker,
285
+ ]
251
286
  );
252
287
 
288
+ const parentRecyclerViewContext = useRecyclerViewContext();
289
+ const recyclerViewId = useId();
290
+
253
291
  // Create context for child components
254
- const recyclerViewContext: RecyclerViewContext = useMemo(() => {
292
+ const recyclerViewContext: RecyclerViewContext<T> = useMemo(() => {
255
293
  return {
256
294
  layout: () => {
257
295
  setLayoutTreeId((prev) => prev + 1);
258
296
  },
259
297
  getRef: () => {
260
- return ref;
298
+ if (recyclerViewManager.isDisposed) {
299
+ return null;
300
+ }
301
+ return handlerMethods;
302
+ },
303
+ getParentRef: () => {
304
+ return parentRecyclerViewContext?.getRef() ?? null;
305
+ },
306
+ getParentScrollViewRef: () => {
307
+ return parentRecyclerViewContext?.getScrollViewRef() ?? null;
261
308
  },
262
309
  getScrollViewRef: () => {
263
- return scrollViewRef;
310
+ return scrollViewRef.current;
264
311
  },
265
312
  markChildLayoutAsPending: (id: string) => {
266
313
  pendingChildIds.add(id);
@@ -272,10 +319,13 @@ const RecyclerViewComponent = <T,>(
272
319
  }
273
320
  },
274
321
  };
275
- }, [setLayoutTreeId]);
276
-
277
- const parentRecyclerViewContext = useRecyclerViewContext();
278
- const recyclerViewId = useId();
322
+ }, [
323
+ handlerMethods,
324
+ parentRecyclerViewContext,
325
+ pendingChildIds,
326
+ recyclerViewManager.isDisposed,
327
+ setLayoutTreeId,
328
+ ]);
279
329
 
280
330
  /**
281
331
  * Validates that item dimensions match the expected layout
@@ -307,7 +357,7 @@ const RecyclerViewComponent = <T,>(
307
357
  recyclerViewContext.layout();
308
358
  }
309
359
  },
310
- [recyclerViewManager]
360
+ [recyclerViewContext, recyclerViewManager]
311
361
  );
312
362
 
313
363
  // Get secondary props and components
@@ -347,7 +397,14 @@ const RecyclerViewComponent = <T,>(
347
397
  );
348
398
  }
349
399
  return null;
350
- }, [data, stickyHeaderIndices, renderItem, extraData]);
400
+ }, [
401
+ data,
402
+ stickyHeaderIndices,
403
+ renderItem,
404
+ scrollY,
405
+ recyclerViewManager,
406
+ extraData,
407
+ ]);
351
408
 
352
409
  // Set up scroll event handling with animation support for sticky headers
353
410
  const animatedEvent = useMemo(() => {
@@ -358,31 +415,24 @@ const RecyclerViewComponent = <T,>(
358
415
  );
359
416
  }
360
417
  return onScrollHandler;
361
- }, [onScrollHandler, stickyHeaders]);
418
+ }, [onScrollHandler, scrollY, stickyHeaders]);
419
+
420
+ const shouldMaintainVisibleContentPosition =
421
+ recyclerViewManager.shouldMaintainVisibleContentPosition();
362
422
 
363
423
  const maintainVisibleContentPositionInternal = useMemo(() => {
364
- if (maintainVisibleContentPosition?.disabled || horizontal) {
365
- return undefined;
366
- } else {
424
+ if (shouldMaintainVisibleContentPosition) {
367
425
  return {
368
426
  ...maintainVisibleContentPosition,
369
427
  minIndexForVisible: 0,
370
428
  };
371
429
  }
372
- }, [maintainVisibleContentPosition]);
430
+ return undefined;
431
+ }, [maintainVisibleContentPosition, shouldMaintainVisibleContentPosition]);
373
432
 
374
433
  const shouldRenderFromBottom =
375
- maintainVisibleContentPositionInternal?.startRenderingFromBottom ?? false;
376
-
377
- // Calculate minimum height adjustment for bottom rendering
378
- const adjustmentMinHeight = recyclerViewManager.hasLayout()
379
- ? Math.max(
380
- 0,
381
- recyclerViewManager.getWindowSize().height -
382
- recyclerViewManager.getChildContainerDimensions().height -
383
- recyclerViewManager.firstItemOffset
384
- )
385
- : 0;
434
+ recyclerViewManager.getDataLength() > 0 &&
435
+ (maintainVisibleContentPosition?.startRenderingFromBottom ?? false);
386
436
 
387
437
  // Create view for measuring bounded size
388
438
  const viewToMeasureBoundedSize = useMemo(() => {
@@ -391,20 +441,35 @@ const RecyclerViewComponent = <T,>(
391
441
  style={{
392
442
  height: horizontal ? undefined : 0,
393
443
  width: horizontal ? 0 : undefined,
394
- minHeight: shouldRenderFromBottom ? adjustmentMinHeight : undefined,
395
444
  }}
396
- ref={childContainerViewRef}
445
+ ref={firstChildViewRef}
397
446
  />
398
447
  );
399
- }, [horizontal, shouldRenderFromBottom, adjustmentMinHeight]);
448
+ }, [horizontal]);
400
449
 
401
- //console.log("render");
450
+ const scrollAnchor = useMemo(() => {
451
+ if (shouldMaintainVisibleContentPosition) {
452
+ return (
453
+ <ScrollAnchor
454
+ horizontal={Boolean(horizontal)}
455
+ scrollAnchorRef={scrollAnchorRef}
456
+ />
457
+ );
458
+ }
459
+ return null;
460
+ }, [horizontal, shouldMaintainVisibleContentPosition]);
461
+
462
+ // console.log("render", recyclerViewManager.getRenderStack());
402
463
 
403
464
  // Render the main RecyclerView structure
404
465
  return (
405
466
  <RecyclerViewContextProvider value={recyclerViewContext}>
406
467
  <CompatView
407
- style={{ flex: horizontal ? undefined : 1, ...style }}
468
+ style={{
469
+ flex: horizontal ? undefined : 1,
470
+ overflow: "hidden",
471
+ ...style,
472
+ }}
408
473
  ref={internalViewRef}
409
474
  collapsable={false}
410
475
  onLayout={(event) => {
@@ -433,7 +498,6 @@ const RecyclerViewComponent = <T,>(
433
498
  horizontal={horizontal}
434
499
  ref={scrollViewRef}
435
500
  onScroll={animatedEvent}
436
- // TODO: evaluate perf
437
501
  maintainVisibleContentPosition={
438
502
  maintainVisibleContentPositionInternal
439
503
  }
@@ -441,11 +505,10 @@ const RecyclerViewComponent = <T,>(
441
505
  {...overrideProps}
442
506
  >
443
507
  {/* Scroll anchor for maintaining content position */}
444
- {maintainVisibleContentPositionInternal && (
445
- <ScrollAnchor scrollAnchorRef={scrollAnchorRef} />
446
- )}
508
+ {scrollAnchor}
509
+ {isHorizontalRTL && viewToMeasureBoundedSize}
447
510
  {renderHeader}
448
- {viewToMeasureBoundedSize}
511
+ {!isHorizontalRTL && viewToMeasureBoundedSize}
449
512
  {/* Main list content */}
450
513
  <ViewHolderCollection
451
514
  viewHolderCollectionRef={viewHolderCollectionRef}
@@ -453,6 +516,25 @@ const RecyclerViewComponent = <T,>(
453
516
  horizontal={horizontal}
454
517
  renderStack={recyclerViewManager.getRenderStack()}
455
518
  getLayout={(index) => recyclerViewManager.getLayout(index)}
519
+ getAdjustmentMargin={() => {
520
+ if (!shouldRenderFromBottom || !recyclerViewManager.hasLayout()) {
521
+ return 0;
522
+ }
523
+
524
+ const windowSize = horizontal
525
+ ? recyclerViewManager.getWindowSize().width
526
+ : recyclerViewManager.getWindowSize().height;
527
+ const childContainerSize = horizontal
528
+ ? recyclerViewManager.getChildContainerDimensions().width
529
+ : recyclerViewManager.getChildContainerDimensions().height;
530
+
531
+ return Math.max(
532
+ 0,
533
+ windowSize -
534
+ childContainerSize -
535
+ recyclerViewManager.firstItemOffset
536
+ );
537
+ }}
456
538
  refHolder={refHolder}
457
539
  onSizeChanged={validateItemSize}
458
540
  renderItem={renderItem}
@@ -465,10 +547,14 @@ const RecyclerViewComponent = <T,>(
465
547
  onCommitLayoutEffect?.();
466
548
  }}
467
549
  onCommitEffect={() => {
550
+ renderTimeTracker.markRenderComplete();
551
+ recyclerViewManager.updateAverageRenderTime(
552
+ renderTimeTracker.getAverageRenderTime()
553
+ );
468
554
  applyInitialScrollIndex();
469
555
  checkBounds();
470
556
  recyclerViewManager.computeItemViewability();
471
- recyclerViewManager.disableRecycling = Boolean(disableRecycling);
557
+ recyclerViewManager.animationOptimizationsEnabled = false;
472
558
  }}
473
559
  CellRendererComponent={CellRendererComponent}
474
560
  ItemSeparatorComponent={ItemSeparatorComponent}
@@ -487,9 +573,12 @@ const RecyclerViewComponent = <T,>(
487
573
  );
488
574
  };
489
575
 
576
+ // Set displayName for the inner component
577
+ RecyclerViewComponent.displayName = "FlashList";
578
+
490
579
  // Type definition for the RecyclerView component
491
580
  type RecyclerViewType = <T>(
492
- props: RecyclerViewProps<T> & { ref?: React.Ref<any> }
581
+ props: RecyclerViewProps<T> & { ref?: React.Ref<FlashListRef<T>> }
493
582
  ) => React.JSX.Element;
494
583
 
495
584
  // Create and export the memoized, forwarded ref component
@@ -1,19 +1,65 @@
1
1
  import { createContext, useContext } from "react";
2
+
3
+ import { FlashListRef } from "../FlashListRef";
4
+
2
5
  import { CompatScroller } from "./components/CompatScroller";
3
6
 
4
- export interface RecyclerViewContext {
5
- layout: () => void;
6
- getRef: () => React.Ref<any>;
7
- getScrollViewRef: () => React.RefObject<CompatScroller | null>;
7
+ export interface RecyclerViewContext<T> extends FlashListContext<T> {
8
+ /**
9
+ * Mark the children FlashLists as pending for layout
10
+ * This will force parent FlashList to wait for children to be laid out before
11
+ * rendering the next batch of items.
12
+ * @param id - The id of the child FlashList
13
+ * @returns void
14
+ */
8
15
  markChildLayoutAsPending: (id: string) => void;
16
+ /**
17
+ * Unmark the child FlashList as pending for layout
18
+ * This will allow parent FlashList to render the next batch of items.
19
+ * @param id - The id of the child FlashList
20
+ * @returns void
21
+ */
9
22
  unmarkChildLayoutAsPending: (id: string) => void;
10
23
  }
11
24
 
25
+ export interface FlashListContext<T> {
26
+ /**
27
+ * Layout the current FlashList
28
+ * @returns void
29
+ */
30
+ layout: () => void;
31
+ /**
32
+ * Get the ref for the current FlashList
33
+ */
34
+ getRef: () => FlashListRef<T> | null;
35
+ /**
36
+ * Get the ref for the parent FlashList if present
37
+ */
38
+ getParentRef: () => FlashListRef<unknown> | null;
39
+ /**
40
+ * Get the scrollView ref for the current FlashList if present
41
+ */
42
+ getScrollViewRef: () => CompatScroller | null;
43
+ /**
44
+ * Get the scrollView ref for the parent FlashList if present
45
+ */
46
+ getParentScrollViewRef: () => CompatScroller | null;
47
+ }
48
+
12
49
  const RecyclerViewContextInstance = createContext<
13
- RecyclerViewContext | undefined
50
+ RecyclerViewContext<unknown> | undefined
14
51
  >(undefined);
15
52
 
16
53
  export const RecyclerViewContextProvider = RecyclerViewContextInstance.Provider;
17
- export function useRecyclerViewContext() {
18
- return useContext(RecyclerViewContextInstance);
54
+ export function useRecyclerViewContext<T>():
55
+ | RecyclerViewContext<T>
56
+ | undefined {
57
+ return useContext(RecyclerViewContextInstance) as
58
+ | RecyclerViewContext<T>
59
+ | undefined;
60
+ }
61
+ export function useFlashListContext<T>(): FlashListContext<T> | undefined {
62
+ return useContext(RecyclerViewContextInstance) as
63
+ | FlashListContext<T>
64
+ | undefined;
19
65
  }