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
@@ -1 +0,0 @@
1
- {"version":3,"file":"findVisibleIndexRange.d.ts","sourceRoot":"","sources":["../../../../src/windowing/findVisibleIndexRange.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAA;AAChE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAEpD;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,SAAS,eAAe,EAAE,EACnC,OAAO,EAAE,aAAa,EACtB,QAAQ,EAAE,MAAM,GACf,SAAS,MAAM,EAAE,CA6CnB"}
@@ -1,56 +0,0 @@
1
- ///
2
- /// HybridNitroLayoutEngineSpec.swift
3
- /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
- /// https://github.com/mrousavy/nitro
5
- /// Copyright © 2025 Marc Rousavy @ Margelo
6
- ///
7
-
8
- import Foundation
9
- import NitroModules
10
-
11
- /// See ``HybridNitroLayoutEngineSpec``
12
- public protocol HybridNitroLayoutEngineSpec_protocol: HybridObject {
13
- // Properties
14
-
15
-
16
- // Methods
17
- func computeLayout(containerWidth: Double, itemHeights: [Double]) throws -> [LayoutRectangle]
18
- }
19
-
20
- public extension HybridNitroLayoutEngineSpec_protocol {
21
- /// Default implementation of ``HybridObject.toString``
22
- func toString() -> String {
23
- return "[HybridObject NitroLayoutEngine]"
24
- }
25
- }
26
-
27
- /// See ``HybridNitroLayoutEngineSpec``
28
- open class HybridNitroLayoutEngineSpec_base {
29
- private weak var cxxWrapper: HybridNitroLayoutEngineSpec_cxx? = nil
30
- public init() { }
31
- public func getCxxWrapper() -> HybridNitroLayoutEngineSpec_cxx {
32
- #if DEBUG
33
- guard self is HybridNitroLayoutEngineSpec else {
34
- fatalError("`self` is not a `HybridNitroLayoutEngineSpec`! Did you accidentally inherit from `HybridNitroLayoutEngineSpec_base` instead of `HybridNitroLayoutEngineSpec`?")
35
- }
36
- #endif
37
- if let cxxWrapper = self.cxxWrapper {
38
- return cxxWrapper
39
- } else {
40
- let cxxWrapper = HybridNitroLayoutEngineSpec_cxx(self as! HybridNitroLayoutEngineSpec)
41
- self.cxxWrapper = cxxWrapper
42
- return cxxWrapper
43
- }
44
- }
45
- }
46
-
47
- /**
48
- * A Swift base-protocol representing the NitroLayoutEngine HybridObject.
49
- * Implement this protocol to create Swift-based instances of NitroLayoutEngine.
50
- * ```swift
51
- * class HybridNitroLayoutEngine : HybridNitroLayoutEngineSpec {
52
- * // ...
53
- * }
54
- * ```
55
- */
56
- public typealias HybridNitroLayoutEngineSpec = HybridNitroLayoutEngineSpec_protocol & HybridNitroLayoutEngineSpec_base
package/src/NitroList.ts DELETED
@@ -1,8 +0,0 @@
1
- import { requireNativeComponent } from 'react-native'
2
-
3
- export type NitroRecyclerViewProps = {
4
- itemCount: number
5
- }
6
-
7
- export const NitroRecyclerView =
8
- requireNativeComponent<NitroRecyclerViewProps>('NitroRecyclerView')
@@ -1,38 +0,0 @@
1
- import type { LayoutRectangle } from './layout/LayoutRectangle'
2
- import type { ScrollMetrics } from './windowing/ScrollMetrics'
3
- import type { Cell } from './cell/Cell'
4
-
5
- import { useCellRenderer } from './hooks/useCellRenderer'
6
-
7
- /**
8
- * INTERNAL hook.
9
- * MUST ALWAYS CALL hooks in the same order.
10
- */
11
- export function useRecyclerListInternal(
12
- layouts: readonly LayoutRectangle[],
13
- metrics: ScrollMetrics,
14
- bufferPx: number,
15
- getItemType: (index: number) => string
16
- ): readonly Cell[] {
17
-
18
- /**
19
- * FlashList rule:
20
- * Hooks are ALWAYS called.
21
- * Inputs are guarded instead.
22
- */
23
- const safeLayouts =
24
- metrics.height > 0 ? layouts : EMPTY_LAYOUTS
25
-
26
- const safeBufferPx =
27
- metrics.height > 0 ? bufferPx : 0
28
-
29
- return useCellRenderer(
30
- safeLayouts,
31
- metrics,
32
- safeBufferPx,
33
- getItemType
34
- )
35
- }
36
-
37
- /** Stable empty reference */
38
- const EMPTY_LAYOUTS: readonly LayoutRectangle[] = []
@@ -1,252 +0,0 @@
1
- import React, {
2
- useMemo,
3
- useRef,
4
- useEffect,
5
- } from 'react'
6
- import {
7
- ScrollView,
8
- View,
9
- StyleSheet,
10
- } from 'react-native'
11
-
12
- import type { Cell } from './cell/Cell'
13
- import type { LayoutRectangle } from './layout/LayoutRectangle'
14
-
15
- import { useRecyclerListInternal } from './RecyclerList.internal'
16
- import { useScrollMetrics } from './windowing'
17
- import { MutableLinearLayout } from './layout/MutableLinearLayout'
18
- import { ViewabilityHelper } from './viewability/ViewabilityHelper'
19
- import { PrefetchHelper } from './prefetch/PrefetchHelper'
20
-
21
- /**
22
- * Public API — mirrors FlashList behavior, not internals.
23
- */
24
- export type RecyclerListProps = {
25
- containerWidth: number
26
- itemCount?: number
27
- itemHeights?: readonly number[]
28
- estimatedItemHeight?: number
29
- renderBufferRatio?: number
30
- getItemType?: (index: number) => string
31
- renderItem: (index: number) => React.ReactElement
32
- onPrefetch?: (indices: number[]) => void
33
- onViewableItemsChanged?: (info: {
34
- viewableItems: { index: number; isViewable: boolean }[]
35
- changed: { index: number; isViewable: boolean }[]
36
- }) => void
37
- }
38
-
39
- /**
40
- * FlashList invariant:
41
- * Never allow viewport height = 0 to gate windowing.
42
- */
43
- const DEFAULT_VIEWPORT_HEIGHT = 800
44
-
45
- export function RecyclerList(props: RecyclerListProps): React.ReactElement {
46
- const {
47
- containerWidth,
48
- itemCount,
49
- itemHeights,
50
- estimatedItemHeight = 80,
51
- renderBufferRatio = 1.3,
52
- getItemType = () => 'default',
53
- renderItem,
54
- onPrefetch,
55
- onViewableItemsChanged,
56
- } = props
57
-
58
- /**
59
- * 🚨 DEV WARNINGS ONLY (never throw in render!)
60
- */
61
- if (__DEV__) {
62
- if (!itemHeights && itemCount == null) {
63
- console.error(
64
- 'RecyclerList requires either itemCount or itemHeights.'
65
- )
66
- }
67
-
68
- if (itemHeights && itemCount != null) {
69
- console.error(
70
- 'Provide only one of itemCount or itemHeights.'
71
- )
72
- }
73
- }
74
-
75
- /**
76
- * STEP 1: Resolve item count safely (props only).
77
- * Never depend on hooks for structural decisions.
78
- */
79
- const itemLength =
80
- itemHeights?.length ??
81
- itemCount ??
82
- 0
83
-
84
- /**
85
- * STEP 2: Resolve initial heights (always defined).
86
- */
87
- const resolvedHeights = useMemo<readonly number[]>(() => {
88
- if (itemHeights) return itemHeights
89
-
90
- return Array.from(
91
- { length: itemLength },
92
- () => estimatedItemHeight
93
- )
94
- }, [itemHeights, itemLength, estimatedItemHeight])
95
-
96
- /**
97
- * STEP 3: Mutable layout lifecycle.
98
- * Recreate layout only when shape changes.
99
- */
100
- const layoutRef = useRef<MutableLinearLayout | null>(null)
101
- const lastLayoutKeyRef = useRef<string | null>(null)
102
-
103
- const layoutKey = `${containerWidth}-${itemLength}`
104
-
105
- if (
106
- !layoutRef.current ||
107
- lastLayoutKeyRef.current !== layoutKey
108
- ) {
109
- layoutRef.current = new MutableLinearLayout(
110
- resolvedHeights,
111
- containerWidth
112
- )
113
- lastLayoutKeyRef.current = layoutKey
114
- }
115
-
116
- /**
117
- * STEP 4: Read layout snapshot.
118
- */
119
- const layouts: readonly LayoutRectangle[] =
120
- layoutRef.current.getLayouts()
121
-
122
- const contentHeight =
123
- layoutRef.current.getContentHeight()
124
-
125
- /**
126
- * STEP 5: Scroll metrics.
127
- */
128
- const {
129
- metrics,
130
- onScroll,
131
- onLayout,
132
- } = useScrollMetrics()
133
-
134
- /**
135
- * STEP 6: Guard initial windowing.
136
- */
137
- const effectiveViewportHeight =
138
- metrics.height > 0
139
- ? metrics.height
140
- : DEFAULT_VIEWPORT_HEIGHT
141
-
142
- const bufferPx =
143
- effectiveViewportHeight * renderBufferRatio
144
-
145
- /**
146
- * STEP 7: Windowing + recycling.
147
- */
148
- const cells: readonly Cell[] =
149
- useRecyclerListInternal(
150
- layouts,
151
- metrics,
152
- bufferPx,
153
- getItemType
154
- )
155
-
156
- /**
157
- * STEP 8: Phase-1 observers.
158
- */
159
- const viewabilityRef = useRef(
160
- new ViewabilityHelper({
161
- itemVisiblePercentThreshold: 50,
162
- })
163
- )
164
-
165
- const prefetchRef = useRef(
166
- new PrefetchHelper()
167
- )
168
-
169
- useEffect(() => {
170
- prefetchRef.current = new PrefetchHelper()
171
- }, [itemLength])
172
-
173
- useEffect(() => {
174
- if (metrics.height === 0) return
175
-
176
- if (onViewableItemsChanged) {
177
- const visibleLayouts: LayoutRectangle[] = []
178
-
179
- for (const cell of cells) {
180
- const layout = layouts[cell.index]
181
- if (layout) visibleLayouts.push(layout)
182
- }
183
-
184
- const info =
185
- viewabilityRef.current.computeViewableItems(
186
- visibleLayouts,
187
- metrics
188
- )
189
-
190
- onViewableItemsChanged(info)
191
- }
192
-
193
- if (onPrefetch && itemLength > 0) {
194
- prefetchRef.current.runPrefetch(
195
- cells.map(c => c.index),
196
- itemLength,
197
- 5,
198
- onPrefetch
199
- )
200
- }
201
- }, [
202
- cells,
203
- metrics.offsetY,
204
- metrics.height,
205
- onViewableItemsChanged,
206
- onPrefetch,
207
- itemLength,
208
- layouts,
209
- ])
210
-
211
- /**
212
- * STEP 9: Render absolutely positioned cells.
213
- */
214
- return (
215
- <ScrollView
216
- style={styles.container}
217
- onLayout={onLayout}
218
- onScroll={onScroll}
219
- scrollEventThrottle={16}
220
- removeClippedSubviews
221
- >
222
- <View style={[styles.content, { height: contentHeight }]}>
223
- {cells.map(cell => {
224
- const layout = layouts[cell.index]
225
- if (!layout) return null
226
-
227
- return (
228
- <View
229
- key={cell.key}
230
- style={[
231
- styles.cell,
232
- {
233
- top: layout.y,
234
- width: layout.width,
235
- height: layout.height,
236
- },
237
- ]}
238
- >
239
- {renderItem(cell.index)}
240
- </View>
241
- )
242
- })}
243
- </View>
244
- </ScrollView>
245
- )
246
- }
247
-
248
- const styles = StyleSheet.create({
249
- container: { flex: 1 },
250
- content: { position: 'relative', width: '100%' },
251
- cell: { position: 'absolute', left: 0 },
252
- })
@@ -1,24 +0,0 @@
1
- import type React from 'react'
2
-
3
- export type RecyclerListProps = {
4
- /** Width of the list container (required) */
5
- readonly containerWidth: number
6
-
7
- /** Total number of items (used with estimatedItemHeight) */
8
- readonly itemCount?: number
9
-
10
- /** Explicit item heights (fast path, skips estimation) */
11
- readonly itemHeights?: readonly number[]
12
-
13
- /** Estimated item height when itemHeights not provided */
14
- readonly estimatedItemHeight?: number
15
-
16
- /** Render buffer multiplier (FlashList-style, default ~1.3) */
17
- readonly renderBufferRatio?: number
18
-
19
- /** Optional item type resolver for recycling */
20
- readonly getItemType?: (index: number) => string
21
-
22
- /** Render function */
23
- readonly renderItem: (index: number) => React.ReactElement
24
- }
@@ -1,55 +0,0 @@
1
- import { findVisibleIndexRange } from '../../windowing/findVisibleIndexRange'
2
-
3
- describe('findVisibleIndexRange', () => {
4
- /**
5
- * Layouts:
6
- * index 0 → y: 0–50
7
- * index 1 → y: 50–100
8
- * index 2 → y: 100–150
9
- * ...
10
- */
11
- const layouts = Array.from({ length: 10 }, (_, i) => ({
12
- x: 0,
13
- y: i * 50,
14
- width: 100,
15
- height: 50,
16
- }))
17
-
18
- it('returns empty array when layouts are empty', () => {
19
- const result = findVisibleIndexRange([], { offsetY: 0, height: 300 }, 100)
20
-
21
- expect(result).toEqual([])
22
- })
23
- it('returns correct visible indices without buffer', () => {
24
- const result = findVisibleIndexRange(
25
- layouts,
26
- { offsetY: 100, height: 150 },
27
- 0
28
- )
29
-
30
- /**
31
- * Viewport: 100–250 (inclusive)
32
- * Items that intersect this window:
33
- * indices 1–5
34
- */
35
- expect(result).toEqual([1, 2, 3, 4, 5])
36
- })
37
-
38
- it('extends window using bufferPx (inclusive boundaries)', () => {
39
- const result = findVisibleIndexRange(
40
- layouts,
41
- { offsetY: 100, height: 100 },
42
- 100
43
- )
44
-
45
- /**
46
- * Viewport: 100–200
47
- * Buffer: ±100
48
- * Effective win: 0–300 (inclusive)
49
- *
50
- * index 6 starts at y = 300 → included by design
51
- * This matches FlashList / RecyclerView behavior
52
- */
53
- expect(result).toEqual([0, 1, 2, 3, 4, 5, 6])
54
- })
55
- })
@@ -1,6 +0,0 @@
1
- export function getStableKey(
2
- slotKey: string,
3
- index: number
4
- ): string {
5
- return `${slotKey}:${index}`
6
- }
@@ -1,86 +0,0 @@
1
- import { useEffect, useMemo, useRef, useState } from 'react'
2
- import type { Cell } from '../cell/Cell'
3
- import { CellRecycler } from '../cell/CellRecycler'
4
- import { findVisibleIndexRange } from '../windowing/findVisibleIndexRange'
5
- import type { LayoutRectangle } from '../layout/LayoutRectangle'
6
- import type { ScrollMetrics } from '../windowing/ScrollMetrics'
7
-
8
- /**
9
- * 🔒 Stable empty references (module-level)
10
- * These MUST NOT be recreated per render.
11
- */
12
- const EMPTY_INDICES: readonly number[] = []
13
-
14
- /**
15
- * React bridge for CellRecycler.
16
- * FlashList equivalent: useCellRenderer
17
- *
18
- * Responsibilities:
19
- * - Translate scroll state → visible indices
20
- * - Ask recycler for physical cells
21
- * - Commit results with referential stability
22
- *
23
- * Responsibilities it does NOT have:
24
- * ❌ Layout mutation
25
- * ❌ Measurement
26
- * ❌ Rendering
27
- */
28
- export function useCellRenderer(
29
- layouts: readonly LayoutRectangle[],
30
- metrics: ScrollMetrics,
31
- bufferPx: number,
32
- getCellType: (index: number) => string
33
- ): readonly Cell[] {
34
- /**
35
- * Recycler instance is stable across renders.
36
- */
37
- const recyclerRef = useRef<CellRecycler>(new CellRecycler())
38
-
39
- /**
40
- * Compute visible indices.
41
- * PURE + TOTAL:
42
- * - Never throws
43
- * - Always returns the same reference when empty
44
- */
45
- const visibleIndices = useMemo(
46
- () =>
47
- layouts.length === 0
48
- ? EMPTY_INDICES
49
- : findVisibleIndexRange(
50
- layouts,
51
- metrics,
52
- bufferPx
53
- ),
54
- [layouts, metrics.offsetY, metrics.height, bufferPx]
55
- )
56
-
57
- /**
58
- * Physical cells to render.
59
- */
60
- const [cells, setCells] =
61
- useState<readonly Cell[]>([])
62
-
63
- /**
64
- * Reconcile visible indices → physical cells.
65
- *
66
- * FlashList invariant:
67
- * - Only update state if identity truly changed
68
- * - Prevents pointless re-renders
69
- */
70
- useEffect(() => {
71
- const next =
72
- recyclerRef.current.reconcile(
73
- visibleIndices,
74
- getCellType
75
- )
76
-
77
- setCells(prev =>
78
- prev.length === next.length &&
79
- prev.every((c, i) => c === next[i])
80
- ? prev
81
- : next
82
- )
83
- }, [visibleIndices, getCellType])
84
-
85
- return cells
86
- }
@@ -1,13 +0,0 @@
1
- import { useRef, useCallback } from 'react'
2
-
3
- export function useStableCallback<T extends (...args: never[]) => unknown>(
4
- fn: T
5
- ): T {
6
- const ref = useRef(fn)
7
- ref.current = fn
8
-
9
- return useCallback(
10
- ((...args: never[]) => ref.current(...args)) as T,
11
- []
12
- )
13
- }
@@ -1,35 +0,0 @@
1
- import type { LayoutProvider } from './LayoutProvider'
2
- import type { LayoutRectangle } from './LayoutRectangle'
3
-
4
- /**
5
- * Layout provider using estimated item heights.
6
- * Used before real measurements are available.
7
- */
8
- export class EstimatedLayoutProvider implements LayoutProvider {
9
- private readonly itemCount: number
10
- private readonly itemHeight: number
11
- private readonly width: number
12
-
13
- constructor(
14
- itemCount: number,
15
- itemHeight: number,
16
- width: number
17
- ) {
18
- this.itemCount = itemCount
19
- this.itemHeight = itemHeight
20
- this.width = width
21
- }
22
-
23
- getItemCount(): number {
24
- return this.itemCount
25
- }
26
-
27
- getLayout(index: number): LayoutRectangle {
28
- return {
29
- x: 0,
30
- y: index * this.itemHeight,
31
- width: this.width,
32
- height: this.itemHeight,
33
- }
34
- }
35
- }
@@ -1,21 +0,0 @@
1
- import type { LayoutProvider } from './LayoutProvider'
2
- import type { LayoutRectangle } from './LayoutRectangle'
3
-
4
- /**
5
- * Resolves layouts eagerly into a contiguous array.
6
- * Pure, deterministic, and reusable.
7
- *
8
- * FlashList equivalent: internal layout resolver.
9
- */
10
- export function computeLayouts(
11
- provider: LayoutProvider
12
- ): readonly LayoutRectangle[] {
13
- const count = provider.getItemCount()
14
- const layouts: LayoutRectangle[] = new Array(count)
15
-
16
- for (let i = 0; i < count; i++) {
17
- layouts[i] = provider.getLayout(i)
18
- }
19
-
20
- return layouts
21
- }
@@ -1,17 +0,0 @@
1
- import type { LayoutRectangle } from './LayoutRectangle'
2
-
3
- /**
4
- * Provides layout information for items.
5
- * FlashList equivalent: LayoutProvider
6
- */
7
- export interface LayoutProvider {
8
- /**
9
- * Total number of items
10
- */
11
- getItemCount(): number
12
-
13
- /**
14
- * Layout rectangle for a given index
15
- */
16
- getLayout(index: number): LayoutRectangle
17
- }
@@ -1,10 +0,0 @@
1
- /**
2
- * Immutable layout rectangle for a single item.
3
- * Equivalent to FlashList's Layout.
4
- */
5
- export interface LayoutRectangle {
6
- readonly x: number
7
- readonly y: number
8
- readonly width: number
9
- readonly height: number
10
- }
@@ -1,7 +0,0 @@
1
- import { NitroModules } from 'react-native-nitro-modules'
2
- import type { NitroLayoutEngine as NitroLayoutEngineSpec } from '../specs/nitro-layout-engine.nitro'
3
-
4
- export const NitroLayoutEngine =
5
- NitroModules.createHybridObject<NitroLayoutEngineSpec>(
6
- 'NitroLayoutEngine'
7
- )
@@ -1,12 +0,0 @@
1
- import type { LayoutRectangle } from '../layout/LayoutRectangle'
2
-
3
- /**
4
- * JS runtime interface backed by Nitro (JSI).
5
- * Must match native HybridNitroList exactly.
6
- */
7
- export interface NitroList {
8
- computeLayout(
9
- containerWidth: number,
10
- itemHeights: readonly number[]
11
- ): readonly LayoutRectangle[]
12
- }
@@ -1,8 +0,0 @@
1
- import { requireNativeComponent } from 'react-native'
2
-
3
- export type NitroRecyclerViewProps = {
4
- itemCount: number
5
- }
6
-
7
- export const NitroRecyclerView =
8
- requireNativeComponent<NitroRecyclerViewProps>('NitroRecyclerView')
@@ -1,17 +0,0 @@
1
- import type { HybridObject } from 'react-native-nitro-modules'
2
-
3
- export interface LayoutRectangle {
4
- readonly x: number
5
- readonly y: number
6
- readonly width: number
7
- readonly height: number
8
- }
9
-
10
- export interface NitroLayoutEngine
11
- extends HybridObject<{ ios: 'swift'; android: 'kotlin' }> {
12
-
13
- computeLayout(
14
- containerWidth: number,
15
- itemHeights: readonly number[]
16
- ): readonly LayoutRectangle[]
17
- }