react-native-nitro-list 0.1.1 → 0.1.3

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 (376) hide show
  1. package/README.md +16 -44
  2. package/ios/HybridNitroList.swift +12 -14
  3. package/lib/commonjs/cell/CellKeyGenerator.js +21 -0
  4. package/lib/commonjs/cell/CellKeyGenerator.js.map +1 -0
  5. package/lib/commonjs/cell/CellRecycler.js +48 -40
  6. package/lib/commonjs/cell/CellRecycler.js.map +1 -1
  7. package/lib/commonjs/cell/createCell.js +21 -0
  8. package/lib/commonjs/cell/createCell.js.map +1 -0
  9. package/lib/commonjs/cell/index.js +20 -0
  10. package/lib/commonjs/cell/index.js.map +1 -0
  11. package/lib/commonjs/getVisibleIndices.js.map +1 -1
  12. package/lib/commonjs/hooks/usePersistentCallback.js +36 -0
  13. package/lib/commonjs/hooks/usePersistentCallback.js.map +1 -0
  14. package/lib/commonjs/index.js +31 -3
  15. package/lib/commonjs/index.js.map +1 -1
  16. package/lib/commonjs/layout/MutableLinearLayout.js +78 -39
  17. package/lib/commonjs/layout/MutableLinearLayout.js.map +1 -1
  18. package/lib/commonjs/layout/constants/layoutDefaults.js +19 -0
  19. package/lib/commonjs/layout/constants/layoutDefaults.js.map +1 -0
  20. package/lib/commonjs/layout/index.js +0 -18
  21. package/lib/commonjs/layout/index.js.map +1 -1
  22. package/lib/commonjs/native/NitroListView.js +20 -0
  23. package/lib/commonjs/native/NitroListView.js.map +1 -0
  24. package/lib/commonjs/recycler/CellPool.js +33 -0
  25. package/lib/commonjs/recycler/CellPool.js.map +1 -0
  26. package/lib/commonjs/recycler/NitroList.js +223 -0
  27. package/lib/commonjs/recycler/NitroList.js.map +1 -0
  28. package/lib/commonjs/scroll/useScrollVelocity.js +20 -0
  29. package/lib/commonjs/scroll/useScrollVelocity.js.map +1 -0
  30. package/lib/commonjs/{native/NitroList.types.js → specs/NitroList.nitro.js} +1 -1
  31. package/lib/commonjs/{layout/LayoutProvider.js.map → specs/NitroList.nitro.js.map} +1 -1
  32. package/lib/commonjs/types/Axis.js +2 -0
  33. package/lib/{module/layout/LayoutProvider.js.map → commonjs/types/Axis.js.map} +1 -1
  34. package/lib/commonjs/types/CellKey.js +2 -0
  35. package/lib/commonjs/{layout/LayoutRectangle.js.map → types/CellKey.js.map} +1 -1
  36. package/lib/commonjs/types/CellType.js +27 -0
  37. package/lib/commonjs/types/CellType.js.map +1 -0
  38. package/lib/commonjs/types/VisibleRange.js +2 -0
  39. package/lib/commonjs/{native/NitroList.types.js.map → types/VisibleRange.js.map} +1 -1
  40. package/lib/commonjs/{RecyclerList.types.js → types/VisibleRangeInput.js} +1 -1
  41. package/lib/commonjs/types/VisibleRangeInput.js.map +1 -0
  42. package/lib/commonjs/types/index.js +13 -0
  43. package/lib/commonjs/types/index.js.map +1 -0
  44. package/lib/commonjs/types/layout/LayoutRect.js +2 -0
  45. package/lib/commonjs/types/layout/LayoutRect.js.map +1 -0
  46. package/lib/commonjs/{specs/nitro-layout-engine.nitro.js → types/layout/LinearLayoutInput.js} +1 -1
  47. package/lib/commonjs/types/layout/LinearLayoutInput.js.map +1 -0
  48. package/lib/commonjs/types/layout/MainAxisPadding.js +26 -0
  49. package/lib/commonjs/types/layout/MainAxisPadding.js.map +1 -0
  50. package/lib/commonjs/types/layout/index.js +2 -0
  51. package/lib/commonjs/types/layout/index.js.map +1 -0
  52. package/lib/commonjs/types/recycler/CellPool.js +42 -0
  53. package/lib/commonjs/types/recycler/CellPool.js.map +1 -0
  54. package/lib/commonjs/{layout/LayoutProvider.js → types/recycler/NitroListProps.js} +1 -1
  55. package/lib/commonjs/types/recycler/NitroListProps.js.map +1 -0
  56. package/lib/commonjs/types/recycler/RecyclerCell.js +6 -0
  57. package/lib/commonjs/types/recycler/RecyclerCell.js.map +1 -0
  58. package/lib/commonjs/types/recycler/RecyclerItemRenderer.js +6 -0
  59. package/lib/commonjs/types/recycler/RecyclerItemRenderer.js.map +1 -0
  60. package/lib/commonjs/types/recycler/index.js +2 -0
  61. package/lib/commonjs/types/recycler/index.js.map +1 -0
  62. package/lib/commonjs/types/scroll/ScrollMetrics.js +6 -0
  63. package/lib/commonjs/types/scroll/ScrollMetrics.js.map +1 -0
  64. package/lib/commonjs/types/scroll/index.js +2 -0
  65. package/lib/commonjs/types/scroll/index.js.map +1 -0
  66. package/lib/commonjs/windowing/computeVisibleItemRange.js +61 -0
  67. package/lib/commonjs/windowing/computeVisibleItemRange.js.map +1 -0
  68. package/lib/commonjs/windowing/index.js +3 -3
  69. package/lib/commonjs/windowing/index.js.map +1 -1
  70. package/lib/module/cell/CellKeyGenerator.js +16 -0
  71. package/lib/module/cell/CellKeyGenerator.js.map +1 -0
  72. package/lib/module/cell/CellRecycler.js +48 -39
  73. package/lib/module/cell/CellRecycler.js.map +1 -1
  74. package/lib/module/cell/createCell.js +17 -0
  75. package/lib/module/cell/createCell.js.map +1 -0
  76. package/lib/module/cell/index.js +7 -0
  77. package/lib/module/cell/index.js.map +1 -0
  78. package/lib/module/getVisibleIndices.js.map +1 -1
  79. package/lib/module/hooks/usePersistentCallback.js +33 -0
  80. package/lib/module/hooks/usePersistentCallback.js.map +1 -0
  81. package/lib/module/index.js +5 -1
  82. package/lib/module/index.js.map +1 -1
  83. package/lib/module/layout/MutableLinearLayout.js +78 -38
  84. package/lib/module/layout/MutableLinearLayout.js.map +1 -1
  85. package/lib/module/layout/constants/layoutDefaults.js +15 -0
  86. package/lib/module/layout/constants/layoutDefaults.js.map +1 -0
  87. package/lib/module/layout/index.js +0 -3
  88. package/lib/module/layout/index.js.map +1 -1
  89. package/lib/module/native/NitroListView.js +17 -0
  90. package/lib/module/native/NitroListView.js.map +1 -0
  91. package/lib/module/recycler/CellPool.js +28 -0
  92. package/lib/module/recycler/CellPool.js.map +1 -0
  93. package/lib/module/recycler/NitroList.js +220 -0
  94. package/lib/module/recycler/NitroList.js.map +1 -0
  95. package/lib/module/scroll/useScrollVelocity.js +16 -0
  96. package/lib/module/scroll/useScrollVelocity.js.map +1 -0
  97. package/lib/module/specs/NitroList.nitro.js +4 -0
  98. package/lib/module/specs/NitroList.nitro.js.map +1 -0
  99. package/lib/module/types/Axis.js +2 -0
  100. package/lib/module/types/Axis.js.map +1 -0
  101. package/lib/module/types/CellKey.js +2 -0
  102. package/lib/module/types/CellKey.js.map +1 -0
  103. package/lib/module/types/CellType.js +22 -0
  104. package/lib/module/types/CellType.js.map +1 -0
  105. package/lib/module/types/VisibleRange.js +2 -0
  106. package/lib/module/types/VisibleRange.js.map +1 -0
  107. package/lib/module/types/VisibleRangeInput.js +4 -0
  108. package/lib/module/types/VisibleRangeInput.js.map +1 -0
  109. package/lib/module/types/index.js +4 -0
  110. package/lib/module/types/index.js.map +1 -0
  111. package/lib/module/types/layout/LayoutRect.js +2 -0
  112. package/lib/module/types/layout/LayoutRect.js.map +1 -0
  113. package/lib/module/types/layout/LinearLayoutInput.js +4 -0
  114. package/lib/module/types/layout/LinearLayoutInput.js.map +1 -0
  115. package/lib/module/types/layout/MainAxisPadding.js +22 -0
  116. package/lib/module/types/layout/MainAxisPadding.js.map +1 -0
  117. package/lib/module/types/layout/index.js +2 -0
  118. package/lib/module/types/layout/index.js.map +1 -0
  119. package/lib/module/types/recycler/CellPool.js +37 -0
  120. package/lib/module/types/recycler/CellPool.js.map +1 -0
  121. package/lib/module/types/recycler/NitroListProps.js +4 -0
  122. package/lib/module/types/recycler/NitroListProps.js.map +1 -0
  123. package/lib/module/types/recycler/RecyclerCell.js +4 -0
  124. package/lib/module/types/recycler/RecyclerCell.js.map +1 -0
  125. package/lib/module/types/recycler/RecyclerItemRenderer.js +4 -0
  126. package/lib/module/types/recycler/RecyclerItemRenderer.js.map +1 -0
  127. package/lib/module/types/recycler/index.js +2 -0
  128. package/lib/module/types/recycler/index.js.map +1 -0
  129. package/lib/module/types/scroll/ScrollMetrics.js +4 -0
  130. package/lib/module/types/scroll/ScrollMetrics.js.map +1 -0
  131. package/lib/module/types/scroll/index.js +2 -0
  132. package/lib/module/types/scroll/index.js.map +1 -0
  133. package/lib/module/windowing/computeVisibleItemRange.js +57 -0
  134. package/lib/module/windowing/computeVisibleItemRange.js.map +1 -0
  135. package/lib/module/windowing/index.js +1 -1
  136. package/lib/module/windowing/index.js.map +1 -1
  137. package/lib/typescript/src/cell/Cell.d.ts +13 -4
  138. package/lib/typescript/src/cell/Cell.d.ts.map +1 -1
  139. package/lib/typescript/src/cell/CellKeyGenerator.d.ts +11 -0
  140. package/lib/typescript/src/cell/CellKeyGenerator.d.ts.map +1 -0
  141. package/lib/typescript/src/cell/CellRecycler.d.ts +19 -11
  142. package/lib/typescript/src/cell/CellRecycler.d.ts.map +1 -1
  143. package/lib/typescript/src/cell/createCell.d.ts +7 -0
  144. package/lib/typescript/src/cell/createCell.d.ts.map +1 -0
  145. package/lib/typescript/src/cell/index.d.ts +4 -0
  146. package/lib/typescript/src/cell/index.d.ts.map +1 -0
  147. package/lib/typescript/src/getVisibleIndices.d.ts +2 -2
  148. package/lib/typescript/src/getVisibleIndices.d.ts.map +1 -1
  149. package/lib/typescript/src/hooks/usePersistentCallback.d.ts +16 -0
  150. package/lib/typescript/src/hooks/usePersistentCallback.d.ts.map +1 -0
  151. package/lib/typescript/src/index.d.ts +3 -2
  152. package/lib/typescript/src/index.d.ts.map +1 -1
  153. package/lib/typescript/src/layout/MutableLinearLayout.d.ts +45 -13
  154. package/lib/typescript/src/layout/MutableLinearLayout.d.ts.map +1 -1
  155. package/lib/typescript/src/layout/constants/layoutDefaults.d.ts +13 -0
  156. package/lib/typescript/src/layout/constants/layoutDefaults.d.ts.map +1 -0
  157. package/lib/typescript/src/layout/index.d.ts +1 -4
  158. package/lib/typescript/src/layout/index.d.ts.map +1 -1
  159. package/lib/typescript/src/native/NitroListView.d.ts +20 -0
  160. package/lib/typescript/src/native/NitroListView.d.ts.map +1 -0
  161. package/lib/typescript/src/recycler/CellPool.d.ts +11 -0
  162. package/lib/typescript/src/recycler/CellPool.d.ts.map +1 -0
  163. package/lib/typescript/src/recycler/NitroList.d.ts +4 -0
  164. package/lib/typescript/src/recycler/NitroList.d.ts.map +1 -0
  165. package/lib/typescript/src/scroll/useScrollVelocity.d.ts +2 -0
  166. package/lib/typescript/src/scroll/useScrollVelocity.d.ts.map +1 -0
  167. package/lib/typescript/src/specs/NitroList.nitro.d.ts +26 -0
  168. package/lib/typescript/src/specs/NitroList.nitro.d.ts.map +1 -0
  169. package/lib/typescript/src/types/Axis.d.ts +11 -0
  170. package/lib/typescript/src/types/Axis.d.ts.map +1 -0
  171. package/lib/typescript/src/types/CellKey.d.ts +2 -0
  172. package/lib/typescript/src/types/CellKey.d.ts.map +1 -0
  173. package/lib/typescript/src/types/CellType.d.ts +22 -0
  174. package/lib/typescript/src/types/CellType.d.ts.map +1 -0
  175. package/lib/typescript/src/types/VisibleRange.d.ts +10 -0
  176. package/lib/typescript/src/types/VisibleRange.d.ts.map +1 -0
  177. package/lib/typescript/src/types/VisibleRangeInput.d.ts +35 -0
  178. package/lib/typescript/src/types/VisibleRangeInput.d.ts.map +1 -0
  179. package/lib/typescript/src/types/index.d.ts +8 -0
  180. package/lib/typescript/src/types/index.d.ts.map +1 -0
  181. package/lib/typescript/src/types/layout/LayoutRect.d.ts +15 -0
  182. package/lib/typescript/src/types/layout/LayoutRect.d.ts.map +1 -0
  183. package/lib/typescript/src/types/layout/LinearLayoutInput.d.ts +10 -0
  184. package/lib/typescript/src/types/layout/LinearLayoutInput.d.ts.map +1 -0
  185. package/lib/typescript/src/types/layout/MainAxisPadding.d.ts +20 -0
  186. package/lib/typescript/src/types/layout/MainAxisPadding.d.ts.map +1 -0
  187. package/lib/typescript/src/types/layout/index.d.ts +4 -0
  188. package/lib/typescript/src/types/layout/index.d.ts.map +1 -0
  189. package/lib/typescript/src/types/recycler/CellPool.d.ts +16 -0
  190. package/lib/typescript/src/types/recycler/CellPool.d.ts.map +1 -0
  191. package/lib/typescript/src/types/recycler/NitroListProps.d.ts +66 -0
  192. package/lib/typescript/src/types/recycler/NitroListProps.d.ts.map +1 -0
  193. package/lib/typescript/src/types/recycler/RecyclerCell.d.ts +12 -0
  194. package/lib/typescript/src/types/recycler/RecyclerCell.d.ts.map +1 -0
  195. package/lib/typescript/src/types/recycler/RecyclerItemRenderer.d.ts +12 -0
  196. package/lib/typescript/src/types/recycler/RecyclerItemRenderer.d.ts.map +1 -0
  197. package/lib/typescript/src/types/recycler/index.d.ts +4 -0
  198. package/lib/typescript/src/types/recycler/index.d.ts.map +1 -0
  199. package/lib/typescript/src/types/scroll/ScrollMetrics.d.ts +15 -0
  200. package/lib/typescript/src/types/scroll/ScrollMetrics.d.ts.map +1 -0
  201. package/lib/typescript/src/types/scroll/index.d.ts +2 -0
  202. package/lib/typescript/src/types/scroll/index.d.ts.map +1 -0
  203. package/lib/typescript/src/windowing/computeVisibleItemRange.d.ts +19 -0
  204. package/lib/typescript/src/windowing/computeVisibleItemRange.d.ts.map +1 -0
  205. package/lib/typescript/src/windowing/index.d.ts +1 -1
  206. package/lib/typescript/src/windowing/index.d.ts.map +1 -1
  207. package/nitro.json +5 -5
  208. package/nitrogen/generated/android/NitroList+autolinking.cmake +2 -2
  209. package/nitrogen/generated/android/NitroListOnLoad.cpp +2 -2
  210. package/nitrogen/generated/android/c++/{JHybridNitroLayoutEngineSpec.cpp → JHybridNitroListSpec.cpp} +15 -15
  211. package/nitrogen/generated/android/c++/{JHybridNitroLayoutEngineSpec.hpp → JHybridNitroListSpec.hpp} +11 -11
  212. package/nitrogen/generated/android/c++/{JLayoutRectangle.hpp → JItemLayout.hpp} +10 -10
  213. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrolist/{HybridNitroLayoutEngineSpec.kt → HybridNitroListSpec.kt} +7 -7
  214. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrolist/{LayoutRectangle.kt → ItemLayout.kt} +5 -5
  215. package/nitrogen/generated/ios/NitroList-Swift-Cxx-Bridge.cpp +9 -9
  216. package/nitrogen/generated/ios/NitroList-Swift-Cxx-Bridge.hpp +27 -27
  217. package/nitrogen/generated/ios/NitroList-Swift-Cxx-Umbrella.hpp +8 -8
  218. package/nitrogen/generated/ios/c++/{HybridNitroLayoutEngineSpecSwift.cpp → HybridNitroListSpecSwift.cpp} +2 -2
  219. package/nitrogen/generated/ios/c++/{HybridNitroLayoutEngineSpecSwift.hpp → HybridNitroListSpecSwift.hpp} +16 -16
  220. package/nitrogen/generated/ios/swift/HybridNitroListSpec.swift +56 -0
  221. package/nitrogen/generated/ios/swift/{HybridNitroLayoutEngineSpec_cxx.swift → HybridNitroListSpec_cxx.swift} +23 -23
  222. package/nitrogen/generated/ios/swift/{LayoutRectangle.swift → ItemLayout.swift} +5 -5
  223. package/nitrogen/generated/shared/c++/{HybridNitroLayoutEngineSpec.cpp → HybridNitroListSpec.cpp} +4 -4
  224. package/nitrogen/generated/shared/c++/{HybridNitroLayoutEngineSpec.hpp → HybridNitroListSpec.hpp} +13 -13
  225. package/nitrogen/generated/shared/c++/{LayoutRectangle.hpp → ItemLayout.hpp} +11 -11
  226. package/package.json +5 -5
  227. package/src/cell/Cell.ts +13 -4
  228. package/src/cell/CellKeyGenerator.ts +17 -0
  229. package/src/cell/CellRecycler.ts +53 -43
  230. package/src/cell/createCell.ts +15 -0
  231. package/src/cell/index.ts +5 -0
  232. package/src/getVisibleIndices.ts +4 -2
  233. package/src/hooks/usePersistentCallback.ts +37 -0
  234. package/src/index.ts +7 -2
  235. package/src/layout/MutableLinearLayout.ts +91 -58
  236. package/src/layout/constants/layoutDefaults.ts +12 -0
  237. package/src/layout/index.ts +1 -4
  238. package/src/native/NitroListView.ts +22 -0
  239. package/src/recycler/CellPool.ts +33 -0
  240. package/src/recycler/NitroList.tsx +317 -0
  241. package/src/scroll/useScrollVelocity.ts +16 -0
  242. package/src/specs/NitroList.nitro.ts +29 -0
  243. package/src/types/Axis.ts +10 -0
  244. package/src/types/CellKey.ts +2 -0
  245. package/src/types/CellType.ts +9 -0
  246. package/src/types/VisibleRange.ts +9 -0
  247. package/src/types/VisibleRangeInput.ts +39 -0
  248. package/src/types/index.ts +15 -0
  249. package/src/types/layout/LayoutRect.ts +14 -0
  250. package/src/types/layout/LinearLayoutInput.ts +12 -0
  251. package/src/types/layout/MainAxisPadding.ts +23 -0
  252. package/src/types/layout/index.ts +3 -0
  253. package/src/types/recycler/CellPool.ts +45 -0
  254. package/src/types/recycler/NitroListProps.ts +74 -0
  255. package/src/types/recycler/RecyclerCell.ts +12 -0
  256. package/src/types/recycler/RecyclerItemRenderer.ts +12 -0
  257. package/src/types/recycler/index.ts +3 -0
  258. package/src/types/scroll/ScrollMetrics.ts +18 -0
  259. package/src/types/scroll/index.ts +1 -0
  260. package/src/windowing/computeVisibleItemRange.ts +82 -0
  261. package/src/windowing/index.ts +1 -1
  262. package/lib/commonjs/NitroList.js +0 -9
  263. package/lib/commonjs/NitroList.js.map +0 -1
  264. package/lib/commonjs/RecyclerList.internal.js +0 -25
  265. package/lib/commonjs/RecyclerList.internal.js.map +0 -1
  266. package/lib/commonjs/RecyclerList.js +0 -171
  267. package/lib/commonjs/RecyclerList.js.map +0 -1
  268. package/lib/commonjs/RecyclerList.types.js.map +0 -1
  269. package/lib/commonjs/cell/StableKey.js +0 -10
  270. package/lib/commonjs/cell/StableKey.js.map +0 -1
  271. package/lib/commonjs/hooks/useCellRenderer.js +0 -62
  272. package/lib/commonjs/hooks/useCellRenderer.js.map +0 -1
  273. package/lib/commonjs/hooks/useStableCallback.js +0 -13
  274. package/lib/commonjs/hooks/useStableCallback.js.map +0 -1
  275. package/lib/commonjs/layout/EstimatedLayoutProvider.js +0 -30
  276. package/lib/commonjs/layout/EstimatedLayoutProvider.js.map +0 -1
  277. package/lib/commonjs/layout/LayoutEngine.js +0 -21
  278. package/lib/commonjs/layout/LayoutEngine.js.map +0 -1
  279. package/lib/commonjs/layout/LayoutRectangle.js +0 -2
  280. package/lib/commonjs/native/NitroLayoutEngine.js +0 -9
  281. package/lib/commonjs/native/NitroLayoutEngine.js.map +0 -1
  282. package/lib/commonjs/native/NitroRecyclerView.js +0 -9
  283. package/lib/commonjs/native/NitroRecyclerView.js.map +0 -1
  284. package/lib/commonjs/specs/nitro-layout-engine.nitro.js.map +0 -1
  285. package/lib/commonjs/viewability/ViewabilityHelper.js +0 -121
  286. package/lib/commonjs/viewability/ViewabilityHelper.js.map +0 -1
  287. package/lib/commonjs/windowing/findVisibleIndexRange.js +0 -48
  288. package/lib/commonjs/windowing/findVisibleIndexRange.js.map +0 -1
  289. package/lib/module/NitroList.js +0 -5
  290. package/lib/module/NitroList.js.map +0 -1
  291. package/lib/module/RecyclerList.internal.js +0 -22
  292. package/lib/module/RecyclerList.internal.js.map +0 -1
  293. package/lib/module/RecyclerList.js +0 -166
  294. package/lib/module/RecyclerList.js.map +0 -1
  295. package/lib/module/RecyclerList.types.js +0 -4
  296. package/lib/module/RecyclerList.types.js.map +0 -1
  297. package/lib/module/cell/StableKey.js +0 -6
  298. package/lib/module/cell/StableKey.js.map +0 -1
  299. package/lib/module/hooks/useCellRenderer.js +0 -58
  300. package/lib/module/hooks/useCellRenderer.js.map +0 -1
  301. package/lib/module/hooks/useStableCallback.js +0 -9
  302. package/lib/module/hooks/useStableCallback.js.map +0 -1
  303. package/lib/module/layout/EstimatedLayoutProvider.js +0 -25
  304. package/lib/module/layout/EstimatedLayoutProvider.js.map +0 -1
  305. package/lib/module/layout/LayoutEngine.js +0 -17
  306. package/lib/module/layout/LayoutEngine.js.map +0 -1
  307. package/lib/module/layout/LayoutProvider.js +0 -4
  308. package/lib/module/layout/LayoutRectangle.js +0 -2
  309. package/lib/module/layout/LayoutRectangle.js.map +0 -1
  310. package/lib/module/native/NitroLayoutEngine.js +0 -5
  311. package/lib/module/native/NitroLayoutEngine.js.map +0 -1
  312. package/lib/module/native/NitroList.types.js +0 -4
  313. package/lib/module/native/NitroList.types.js.map +0 -1
  314. package/lib/module/native/NitroRecyclerView.js +0 -5
  315. package/lib/module/native/NitroRecyclerView.js.map +0 -1
  316. package/lib/module/specs/nitro-layout-engine.nitro.js +0 -4
  317. package/lib/module/specs/nitro-layout-engine.nitro.js.map +0 -1
  318. package/lib/module/viewability/ViewabilityHelper.js +0 -116
  319. package/lib/module/viewability/ViewabilityHelper.js.map +0 -1
  320. package/lib/module/windowing/findVisibleIndexRange.js +0 -44
  321. package/lib/module/windowing/findVisibleIndexRange.js.map +0 -1
  322. package/lib/typescript/src/NitroList.d.ts +0 -5
  323. package/lib/typescript/src/NitroList.d.ts.map +0 -1
  324. package/lib/typescript/src/RecyclerList.d.ts +0 -26
  325. package/lib/typescript/src/RecyclerList.d.ts.map +0 -1
  326. package/lib/typescript/src/RecyclerList.internal.d.ts +0 -9
  327. package/lib/typescript/src/RecyclerList.internal.d.ts.map +0 -1
  328. package/lib/typescript/src/RecyclerList.types.d.ts +0 -18
  329. package/lib/typescript/src/RecyclerList.types.d.ts.map +0 -1
  330. package/lib/typescript/src/__tests__/windowing/findVisibleIndexRange.test.d.ts +0 -2
  331. package/lib/typescript/src/__tests__/windowing/findVisibleIndexRange.test.d.ts.map +0 -1
  332. package/lib/typescript/src/cell/StableKey.d.ts +0 -2
  333. package/lib/typescript/src/cell/StableKey.d.ts.map +0 -1
  334. package/lib/typescript/src/hooks/useCellRenderer.d.ts +0 -19
  335. package/lib/typescript/src/hooks/useCellRenderer.d.ts.map +0 -1
  336. package/lib/typescript/src/hooks/useStableCallback.d.ts +0 -2
  337. package/lib/typescript/src/hooks/useStableCallback.d.ts.map +0 -1
  338. package/lib/typescript/src/layout/EstimatedLayoutProvider.d.ts +0 -15
  339. package/lib/typescript/src/layout/EstimatedLayoutProvider.d.ts.map +0 -1
  340. package/lib/typescript/src/layout/LayoutEngine.d.ts +0 -10
  341. package/lib/typescript/src/layout/LayoutEngine.d.ts.map +0 -1
  342. package/lib/typescript/src/layout/LayoutProvider.d.ts +0 -16
  343. package/lib/typescript/src/layout/LayoutProvider.d.ts.map +0 -1
  344. package/lib/typescript/src/layout/LayoutRectangle.d.ts +0 -11
  345. package/lib/typescript/src/layout/LayoutRectangle.d.ts.map +0 -1
  346. package/lib/typescript/src/native/NitroLayoutEngine.d.ts +0 -3
  347. package/lib/typescript/src/native/NitroLayoutEngine.d.ts.map +0 -1
  348. package/lib/typescript/src/native/NitroList.types.d.ts +0 -9
  349. package/lib/typescript/src/native/NitroList.types.d.ts.map +0 -1
  350. package/lib/typescript/src/native/NitroRecyclerView.d.ts +0 -5
  351. package/lib/typescript/src/native/NitroRecyclerView.d.ts.map +0 -1
  352. package/lib/typescript/src/specs/nitro-layout-engine.nitro.d.ts +0 -14
  353. package/lib/typescript/src/specs/nitro-layout-engine.nitro.d.ts.map +0 -1
  354. package/lib/typescript/src/viewability/ViewabilityHelper.d.ts +0 -50
  355. package/lib/typescript/src/viewability/ViewabilityHelper.d.ts.map +0 -1
  356. package/lib/typescript/src/windowing/findVisibleIndexRange.d.ts +0 -11
  357. package/lib/typescript/src/windowing/findVisibleIndexRange.d.ts.map +0 -1
  358. package/nitrogen/generated/ios/swift/HybridNitroLayoutEngineSpec.swift +0 -56
  359. package/src/NitroList.ts +0 -8
  360. package/src/RecyclerList.internal.ts +0 -38
  361. package/src/RecyclerList.tsx +0 -252
  362. package/src/RecyclerList.types.ts +0 -24
  363. package/src/__tests__/windowing/findVisibleIndexRange.test.ts +0 -55
  364. package/src/cell/StableKey.ts +0 -6
  365. package/src/hooks/useCellRenderer.ts +0 -86
  366. package/src/hooks/useStableCallback.ts +0 -13
  367. package/src/layout/EstimatedLayoutProvider.ts +0 -35
  368. package/src/layout/LayoutEngine.ts +0 -21
  369. package/src/layout/LayoutProvider.ts +0 -17
  370. package/src/layout/LayoutRectangle.ts +0 -10
  371. package/src/native/NitroLayoutEngine.ts +0 -7
  372. package/src/native/NitroList.types.ts +0 -12
  373. package/src/native/NitroRecyclerView.ts +0 -8
  374. package/src/specs/nitro-layout-engine.nitro.ts +0 -17
  375. package/src/viewability/ViewabilityHelper.ts +0 -130
  376. package/src/windowing/findVisibleIndexRange.ts +0 -60
@@ -0,0 +1,9 @@
1
+ /** * CellType is just a string, but we give it a name
2
+ * so the code is easier to read.
3
+ */
4
+ export type CellType = string;
5
+
6
+ /** * This is an "Identity" function. It doesn't do anything
7
+ * to the computer, but it helps the human reading the code.
8
+ */
9
+ export const cellType = (name: string): CellType => name;
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Visible item index range.
3
+ *
4
+ * Indices are inclusive.
5
+ */
6
+ export interface VisibleRange {
7
+ readonly startIndex: number
8
+ readonly endIndex: number
9
+ }
@@ -0,0 +1,39 @@
1
+ import type { LayoutRect } from './layout/LayoutRect'
2
+
3
+ /**
4
+ * Input required to compute the visible item range.
5
+ *
6
+ * Pure contract:
7
+ * - No logic
8
+ * - No platform assumptions
9
+ * - Safe to share with native / tests
10
+ */
11
+ export interface VisibleRangeInput {
12
+ /**
13
+ * Ordered, monotonic layouts along the main axis.
14
+ * Required for binary search correctness.
15
+ */
16
+ readonly layouts: readonly LayoutRect[]
17
+
18
+ /**
19
+ * Scroll offset along the main axis.
20
+ */
21
+ readonly offset: number
22
+
23
+ /**
24
+ * Viewport size along the main axis.
25
+ */
26
+ readonly viewportSize: number
27
+
28
+ /**
29
+ * Extra buffer before and after the viewport.
30
+ */
31
+ readonly buffer: number
32
+
33
+ /**
34
+ * Axis selector.
35
+ * true → vertical
36
+ * false → horizontal
37
+ */
38
+ readonly isVertical: boolean
39
+ }
@@ -0,0 +1,15 @@
1
+ export type { Axis } from './Axis'
2
+
3
+ export type {
4
+ MainAxisPadding,
5
+ } from './layout/MainAxisPadding'
6
+ export {
7
+ ZERO_MAIN_AXIS_PADDING,
8
+ } from './layout/MainAxisPadding'
9
+
10
+ export type { LayoutRect } from './layout/LayoutRect'
11
+ export type { VisibleRange } from './VisibleRange'
12
+ export type { CellKey } from './CellKey'
13
+ export type { CellType } from './CellType'
14
+
15
+
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Absolute layout rectangle.
3
+ *
4
+ * Cross-platform equivalent of:
5
+ * - Flutter: Rect
6
+ * - Android: Rect
7
+ * - iOS: CGRect
8
+ */
9
+ export interface LayoutRect {
10
+ readonly x: number
11
+ readonly y: number
12
+ readonly width: number
13
+ readonly height: number
14
+ }
@@ -0,0 +1,12 @@
1
+ import type { MainAxisPadding } from './MainAxisPadding'
2
+
3
+ export interface LinearLayoutInput {
4
+ readonly crossAxisSize: number
5
+ readonly itemMainAxisSizes: readonly number[]
6
+
7
+ /** Padding before/after content (main axis) */
8
+ readonly padding: MainAxisPadding
9
+
10
+ /** Space BETWEEN items (main axis) */
11
+ readonly itemSpacing?: number
12
+ }
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Padding applied along the main scroll axis.
3
+ *
4
+ * This is a layout-level concept (not visual styling).
5
+ *
6
+ * - vertical → top / bottom
7
+ * - horizontal → left / right
8
+ *
9
+ * Uses start/end to remain RTL-safe and platform-neutral.
10
+ */
11
+ export interface MainAxisPadding {
12
+ readonly start: number
13
+ readonly end: number
14
+ }
15
+
16
+ /**
17
+ * Shared zero-padding constant.
18
+ * Safe to reuse across layouts.
19
+ */
20
+ export const ZERO_MAIN_AXIS_PADDING: MainAxisPadding = {
21
+ start: 0,
22
+ end: 0,
23
+ }
@@ -0,0 +1,3 @@
1
+ export type { LayoutRect } from './LayoutRect'
2
+ export type { LinearLayoutInput } from './LinearLayoutInput'
3
+ export type { MainAxisPadding } from './MainAxisPadding'
@@ -0,0 +1,45 @@
1
+ import type { CellType } from "../CellType"
2
+ import type { RecyclerCell } from "./RecyclerCell"
3
+
4
+
5
+ /**
6
+ * Owns recycled physical cells.
7
+ * Enforces hard caps.
8
+ */
9
+ export class CellPool<T extends RecyclerCell> {
10
+ private readonly pools = new Map<CellType, T[]>()
11
+ private readonly maxPerType = new Map<CellType, number>()
12
+
13
+ hasType(type: CellType): boolean {
14
+ return this.pools.has(type)
15
+ }
16
+
17
+ registerType(type: CellType, maxCount: number): void {
18
+ if (this.pools.has(type)) return
19
+ this.pools.set(type, [])
20
+ this.maxPerType.set(type, maxCount)
21
+ }
22
+
23
+ acquire(type: CellType): T | null {
24
+ const bucket = this.pools.get(type)
25
+ if (!bucket || bucket.length === 0) return null
26
+ return bucket.pop() ?? null
27
+ }
28
+
29
+ release(cell: T): void {
30
+ const bucket = this.pools.get(cell.type)
31
+ const max = this.maxPerType.get(cell.type)
32
+ if (!bucket || max === undefined) return
33
+
34
+ cell.index = -1
35
+ if (bucket.length >= max) return
36
+
37
+ bucket.push(cell)
38
+ }
39
+
40
+ clear(): void {
41
+ for (const bucket of this.pools.values()) {
42
+ bucket.length = 0
43
+ }
44
+ }
45
+ }
@@ -0,0 +1,74 @@
1
+ import type { Axis } from '../Axis'
2
+ import type { CellType } from '../CellType'
3
+ import type { MainAxisPadding } from '../layout'
4
+ import type { RecyclerItemRenderer } from './RecyclerItemRenderer'
5
+
6
+ /**
7
+ * Public props for NitroList.
8
+ *
9
+ * Generic, data-driven, layout-deterministic API.
10
+ * This surface is intentionally minimal and stable.
11
+ */
12
+ export interface NitroListProps<T> {
13
+ /**
14
+ * Scroll direction.
15
+ * Defaults to 'vertical'.
16
+ */
17
+ readonly scrollDirection?: Axis
18
+
19
+ /**
20
+ * Cross-axis size.
21
+ * - vertical → width
22
+ * - horizontal → height
23
+ *
24
+ * Required for deterministic layout.
25
+ */
26
+ readonly containerCrossAxisSize: number
27
+
28
+ /**
29
+ * Data source.
30
+ * Length is the single source of truth for item count.
31
+ */
32
+ readonly data: readonly T[]
33
+
34
+ /**
35
+ * Item sizes along the main axis.
36
+ * Must match data length.
37
+ *
38
+ * - vertical → heights
39
+ * - horizontal → widths
40
+ */
41
+ readonly itemMainAxisSizes: readonly number[]
42
+
43
+ /**
44
+ * Padding before and after content along the main axis.
45
+ *
46
+ * Defaults are applied internally by the layout engine.
47
+ */
48
+ readonly padding?: MainAxisPadding
49
+
50
+ /**
51
+ * Space BETWEEN items along the main axis.
52
+ *
53
+ * Defaults are applied internally by the layout engine.
54
+ */
55
+ readonly itemSpacing?: number
56
+
57
+ /**
58
+ * Extra render buffer as a ratio of viewport size.
59
+ * Used for overscan / pre-rendering.
60
+ */
61
+ readonly bufferRatio?: number
62
+
63
+ /**
64
+ * Logical cell type resolver.
65
+ * Determines recycling compatibility.
66
+ */
67
+ readonly getCellType: (item: T, index: number) => CellType
68
+
69
+ /**
70
+ * Item renderer.
71
+ * Receives stable cell identity and data.
72
+ */
73
+ readonly renderItem: RecyclerItemRenderer<T>
74
+ }
@@ -0,0 +1,12 @@
1
+ import type { CellType } from '../CellType'
2
+ import type { CellKey } from '../CellKey'
3
+
4
+ /**
5
+ * Public contract for a physical recycler cell.
6
+ * Key type MUST be generic / opaque.
7
+ */
8
+ export interface RecyclerCell<K = CellKey> {
9
+ readonly key: K
10
+ readonly type: CellType
11
+ index: number
12
+ }
@@ -0,0 +1,12 @@
1
+ import type { ReactNode } from 'react'
2
+ import type { RecyclerCell } from './RecyclerCell'
3
+
4
+ /**
5
+ * Public renderItem signature for RecyclerList.
6
+ * Renderers receive a stable physical cell contract.
7
+ */
8
+ export type RecyclerItemRenderer<T> = (params: {
9
+ item: T
10
+ index: number
11
+ cell: RecyclerCell
12
+ }) => ReactNode
@@ -0,0 +1,3 @@
1
+ export type { NitroListProps } from './NitroListProps'
2
+ export type { RecyclerItemRenderer } from './RecyclerItemRenderer'
3
+ export type { RecyclerCell } from './RecyclerCell'
@@ -0,0 +1,18 @@
1
+ import type { Axis } from "../Axis"
2
+
3
+
4
+ /**
5
+ * Scroll state snapshot.
6
+ *
7
+ * Pure data — no platform or React coupling.
8
+ */
9
+ export interface ScrollMetrics {
10
+ /** Scroll axis */
11
+ readonly axis: Axis
12
+
13
+ /** Offset along the main axis */
14
+ readonly offset: number
15
+
16
+ /** Viewport size along the main axis */
17
+ readonly viewportSize: number
18
+ }
@@ -0,0 +1 @@
1
+ export type { ScrollMetrics } from './ScrollMetrics'
@@ -0,0 +1,82 @@
1
+ import type { LayoutRect } from "../types/layout"
2
+
3
+
4
+ export type VisibleRange = {
5
+ startIndex: number
6
+ endIndex: number
7
+ }
8
+
9
+ type Input = {
10
+ layouts: readonly LayoutRect[]
11
+ offset: number
12
+ viewportSize: number
13
+ buffer: number
14
+ isVertical: boolean
15
+ }
16
+
17
+ /**
18
+ * Computes visible item range using binary search + forward scan.
19
+ * Type-safe and defensive against invalid indices.
20
+ */
21
+ export function computeVisibleItemRange(
22
+ input: Input
23
+ ): VisibleRange | null {
24
+ const {
25
+ layouts,
26
+ offset,
27
+ viewportSize,
28
+ buffer,
29
+ isVertical,
30
+ } = input
31
+
32
+ const count = layouts.length
33
+ if (count === 0) return null
34
+
35
+ const windowStart = Math.max(0, offset - buffer)
36
+ const windowEnd = offset + viewportSize + buffer
37
+
38
+ // ------------------------------
39
+ // Binary search: first visible
40
+ // ------------------------------
41
+ let low = 0
42
+ let high = count - 1
43
+ let first = count
44
+
45
+ while (low <= high) {
46
+ const mid = (low + high) >>> 1
47
+ const rect = layouts[mid]
48
+ if (!rect) break
49
+
50
+ const start = isVertical ? rect.y : rect.x
51
+ const size = isVertical ? rect.height : rect.width
52
+
53
+ if (start + size >= windowStart) {
54
+ first = mid
55
+ high = mid - 1
56
+ } else {
57
+ low = mid + 1
58
+ }
59
+ }
60
+
61
+ if (first === count) return null
62
+
63
+ // ------------------------------
64
+ // Linear scan: last visible
65
+ // ------------------------------
66
+ let last = first
67
+
68
+ for (let i = first + 1; i < count; i++) {
69
+ const rect = layouts[i]
70
+ if (!rect) break
71
+
72
+ const start = isVertical ? rect.y : rect.x
73
+ if (start > windowEnd) break
74
+
75
+ last = i
76
+ }
77
+
78
+ return {
79
+ startIndex: first,
80
+ endIndex: last,
81
+ }
82
+ }
@@ -1,3 +1,3 @@
1
1
  export type { ScrollMetrics } from './ScrollMetrics'
2
- export { findVisibleIndexRange } from './findVisibleIndexRange'
3
2
  export { useScrollMetrics } from './useScrollMetrics'
3
+ export { computeVisibleItemRange } from './computeVisibleItemRange'
@@ -1,9 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.NitroRecyclerView = void 0;
7
- var _reactNative = require("react-native");
8
- const NitroRecyclerView = exports.NitroRecyclerView = (0, _reactNative.requireNativeComponent)('NitroRecyclerView');
9
- //# sourceMappingURL=NitroList.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["_reactNative","require","NitroRecyclerView","exports","requireNativeComponent"],"sourceRoot":"../../src","sources":["NitroList.ts"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAMO,MAAMC,iBAAiB,GAAAC,OAAA,CAAAD,iBAAA,GAC5B,IAAAE,mCAAsB,EAAyB,mBAAmB,CAAC","ignoreList":[]}
@@ -1,25 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.useRecyclerListInternal = useRecyclerListInternal;
7
- var _useCellRenderer = require("./hooks/useCellRenderer");
8
- /**
9
- * INTERNAL hook.
10
- * MUST ALWAYS CALL hooks in the same order.
11
- */
12
- function useRecyclerListInternal(layouts, metrics, bufferPx, getItemType) {
13
- /**
14
- * FlashList rule:
15
- * Hooks are ALWAYS called.
16
- * Inputs are guarded instead.
17
- */
18
- const safeLayouts = metrics.height > 0 ? layouts : EMPTY_LAYOUTS;
19
- const safeBufferPx = metrics.height > 0 ? bufferPx : 0;
20
- return (0, _useCellRenderer.useCellRenderer)(safeLayouts, metrics, safeBufferPx, getItemType);
21
- }
22
-
23
- /** Stable empty reference */
24
- const EMPTY_LAYOUTS = [];
25
- //# sourceMappingURL=RecyclerList.internal.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["_useCellRenderer","require","useRecyclerListInternal","layouts","metrics","bufferPx","getItemType","safeLayouts","height","EMPTY_LAYOUTS","safeBufferPx","useCellRenderer"],"sourceRoot":"../../src","sources":["RecyclerList.internal.ts"],"mappings":";;;;;;AAIA,IAAAA,gBAAA,GAAAC,OAAA;AAEA;AACA;AACA;AACA;AACO,SAASC,uBAAuBA,CACrCC,OAAmC,EACnCC,OAAsB,EACtBC,QAAgB,EAChBC,WAAsC,EACrB;EAEjB;AACF;AACA;AACA;AACA;EACE,MAAMC,WAAW,GACfH,OAAO,CAACI,MAAM,GAAG,CAAC,GAAGL,OAAO,GAAGM,aAAa;EAE9C,MAAMC,YAAY,GAChBN,OAAO,CAACI,MAAM,GAAG,CAAC,GAAGH,QAAQ,GAAG,CAAC;EAEnC,OAAO,IAAAM,gCAAe,EACpBJ,WAAW,EACXH,OAAO,EACPM,YAAY,EACZJ,WACF,CAAC;AACH;;AAEA;AACA,MAAMG,aAAyC,GAAG,EAAE","ignoreList":[]}
@@ -1,171 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.RecyclerList = RecyclerList;
7
- var _react = _interopRequireWildcard(require("react"));
8
- var _reactNative = require("react-native");
9
- var _RecyclerList = require("./RecyclerList.internal");
10
- var _windowing = require("./windowing");
11
- var _MutableLinearLayout = require("./layout/MutableLinearLayout");
12
- var _ViewabilityHelper = require("./viewability/ViewabilityHelper");
13
- var _PrefetchHelper = require("./prefetch/PrefetchHelper");
14
- var _jsxRuntime = require("react/jsx-runtime");
15
- function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
16
- /**
17
- * Public API — mirrors FlashList behavior, not internals.
18
- */
19
-
20
- /**
21
- * FlashList invariant:
22
- * Never allow viewport height = 0 to gate windowing.
23
- */
24
- const DEFAULT_VIEWPORT_HEIGHT = 800;
25
- function RecyclerList(props) {
26
- const {
27
- containerWidth,
28
- itemCount,
29
- itemHeights,
30
- estimatedItemHeight = 80,
31
- renderBufferRatio = 1.3,
32
- getItemType = () => 'default',
33
- renderItem,
34
- onPrefetch,
35
- onViewableItemsChanged
36
- } = props;
37
-
38
- /**
39
- * 🚨 DEV WARNINGS ONLY (never throw in render!)
40
- */
41
- if (__DEV__) {
42
- if (!itemHeights && itemCount == null) {
43
- console.error('RecyclerList requires either itemCount or itemHeights.');
44
- }
45
- if (itemHeights && itemCount != null) {
46
- console.error('Provide only one of itemCount or itemHeights.');
47
- }
48
- }
49
-
50
- /**
51
- * STEP 1: Resolve item count safely (props only).
52
- * Never depend on hooks for structural decisions.
53
- */
54
- const itemLength = itemHeights?.length ?? itemCount ?? 0;
55
-
56
- /**
57
- * STEP 2: Resolve initial heights (always defined).
58
- */
59
- const resolvedHeights = (0, _react.useMemo)(() => {
60
- if (itemHeights) return itemHeights;
61
- return Array.from({
62
- length: itemLength
63
- }, () => estimatedItemHeight);
64
- }, [itemHeights, itemLength, estimatedItemHeight]);
65
-
66
- /**
67
- * STEP 3: Mutable layout lifecycle.
68
- * Recreate layout only when shape changes.
69
- */
70
- const layoutRef = (0, _react.useRef)(null);
71
- const lastLayoutKeyRef = (0, _react.useRef)(null);
72
- const layoutKey = `${containerWidth}-${itemLength}`;
73
- if (!layoutRef.current || lastLayoutKeyRef.current !== layoutKey) {
74
- layoutRef.current = new _MutableLinearLayout.MutableLinearLayout(resolvedHeights, containerWidth);
75
- lastLayoutKeyRef.current = layoutKey;
76
- }
77
-
78
- /**
79
- * STEP 4: Read layout snapshot.
80
- */
81
- const layouts = layoutRef.current.getLayouts();
82
- const contentHeight = layoutRef.current.getContentHeight();
83
-
84
- /**
85
- * STEP 5: Scroll metrics.
86
- */
87
- const {
88
- metrics,
89
- onScroll,
90
- onLayout
91
- } = (0, _windowing.useScrollMetrics)();
92
-
93
- /**
94
- * STEP 6: Guard initial windowing.
95
- */
96
- const effectiveViewportHeight = metrics.height > 0 ? metrics.height : DEFAULT_VIEWPORT_HEIGHT;
97
- const bufferPx = effectiveViewportHeight * renderBufferRatio;
98
-
99
- /**
100
- * STEP 7: Windowing + recycling.
101
- */
102
- const cells = (0, _RecyclerList.useRecyclerListInternal)(layouts, metrics, bufferPx, getItemType);
103
-
104
- /**
105
- * STEP 8: Phase-1 observers.
106
- */
107
- const viewabilityRef = (0, _react.useRef)(new _ViewabilityHelper.ViewabilityHelper({
108
- itemVisiblePercentThreshold: 50
109
- }));
110
- const prefetchRef = (0, _react.useRef)(new _PrefetchHelper.PrefetchHelper());
111
- (0, _react.useEffect)(() => {
112
- prefetchRef.current = new _PrefetchHelper.PrefetchHelper();
113
- }, [itemLength]);
114
- (0, _react.useEffect)(() => {
115
- if (metrics.height === 0) return;
116
- if (onViewableItemsChanged) {
117
- const visibleLayouts = [];
118
- for (const cell of cells) {
119
- const layout = layouts[cell.index];
120
- if (layout) visibleLayouts.push(layout);
121
- }
122
- const info = viewabilityRef.current.computeViewableItems(visibleLayouts, metrics);
123
- onViewableItemsChanged(info);
124
- }
125
- if (onPrefetch && itemLength > 0) {
126
- prefetchRef.current.runPrefetch(cells.map(c => c.index), itemLength, 5, onPrefetch);
127
- }
128
- }, [cells, metrics.offsetY, metrics.height, onViewableItemsChanged, onPrefetch, itemLength, layouts]);
129
-
130
- /**
131
- * STEP 9: Render absolutely positioned cells.
132
- */
133
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.ScrollView, {
134
- style: styles.container,
135
- onLayout: onLayout,
136
- onScroll: onScroll,
137
- scrollEventThrottle: 16,
138
- removeClippedSubviews: true,
139
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
140
- style: [styles.content, {
141
- height: contentHeight
142
- }],
143
- children: cells.map(cell => {
144
- const layout = layouts[cell.index];
145
- if (!layout) return null;
146
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
147
- style: [styles.cell, {
148
- top: layout.y,
149
- width: layout.width,
150
- height: layout.height
151
- }],
152
- children: renderItem(cell.index)
153
- }, cell.key);
154
- })
155
- })
156
- });
157
- }
158
- const styles = _reactNative.StyleSheet.create({
159
- container: {
160
- flex: 1
161
- },
162
- content: {
163
- position: 'relative',
164
- width: '100%'
165
- },
166
- cell: {
167
- position: 'absolute',
168
- left: 0
169
- }
170
- });
171
- //# sourceMappingURL=RecyclerList.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_RecyclerList","_windowing","_MutableLinearLayout","_ViewabilityHelper","_PrefetchHelper","_jsxRuntime","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","DEFAULT_VIEWPORT_HEIGHT","RecyclerList","props","containerWidth","itemCount","itemHeights","estimatedItemHeight","renderBufferRatio","getItemType","renderItem","onPrefetch","onViewableItemsChanged","__DEV__","console","error","itemLength","length","resolvedHeights","useMemo","Array","from","layoutRef","useRef","lastLayoutKeyRef","layoutKey","current","MutableLinearLayout","layouts","getLayouts","contentHeight","getContentHeight","metrics","onScroll","onLayout","useScrollMetrics","effectiveViewportHeight","height","bufferPx","cells","useRecyclerListInternal","viewabilityRef","ViewabilityHelper","itemVisiblePercentThreshold","prefetchRef","PrefetchHelper","useEffect","visibleLayouts","cell","layout","index","push","info","computeViewableItems","runPrefetch","map","c","offsetY","jsx","ScrollView","style","styles","container","scrollEventThrottle","removeClippedSubviews","children","View","content","top","y","width","key","StyleSheet","create","flex","position","left"],"sourceRoot":"../../src","sources":["RecyclerList.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AAKA,IAAAC,YAAA,GAAAD,OAAA;AASA,IAAAE,aAAA,GAAAF,OAAA;AACA,IAAAG,UAAA,GAAAH,OAAA;AACA,IAAAI,oBAAA,GAAAJ,OAAA;AACA,IAAAK,kBAAA,GAAAL,OAAA;AACA,IAAA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EX,CAAC;IAAC,CACE;EAAC,CACG,CAAC;AAEjB;AAEA,MAAMV,MAAM,GAAGW,uBAAU,CAACC,MAAM,CAAC;EAC/BX,SAAS,EAAE;IAAEY,IAAI,EAAE;EAAE,CAAC;EACtBP,OAAO,EAAE;IAAEQ,QAAQ,EAAE,UAAU;IAAEL,KAAK,EAAE;EAAO,CAAC;EAChDtB,IAAI,EAAE;IAAE2B,QAAQ,EAAE,UAAU;IAAEC,IAAI,EAAE;EAAE;AACxC,CAAC,CAAC","ignoreList":[]}
@@ -1 +0,0 @@
1
- {"version":3,"names":[],"sourceRoot":"../../src","sources":["RecyclerList.types.ts"],"mappings":"","ignoreList":[]}
@@ -1,10 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.getStableKey = getStableKey;
7
- function getStableKey(slotKey, index) {
8
- return `${slotKey}:${index}`;
9
- }
10
- //# sourceMappingURL=StableKey.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["getStableKey","slotKey","index"],"sourceRoot":"../../../src","sources":["cell/StableKey.ts"],"mappings":";;;;;;AAAO,SAASA,YAAYA,CAC1BC,OAAe,EACfC,KAAa,EACL;EACR,OAAO,GAAGD,OAAO,IAAIC,KAAK,EAAE;AAC9B","ignoreList":[]}