react-native-nitro-list 0.0.1 → 0.1.1

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 (336) hide show
  1. package/README.md +250 -16
  2. package/android/build.gradle +5 -4
  3. package/android/src/main/java/com/nitrolist/HybridNitroRecyclerView.kt +26 -0
  4. package/android/src/main/java/com/nitrolist/HybridNitroRecyclerViewManager.kt +29 -0
  5. package/android/src/main/java/com/nitrolist/NitroListPackage.kt +13 -24
  6. package/android/src/main/java/com/nitrolist/NitroRecyclerAdapter.kt +32 -0
  7. package/android/src/main/java/com/nitrolist/NitroRecyclerViewHolder.kt +8 -0
  8. package/ios/HybridNitroList.swift +32 -15
  9. package/lib/commonjs/NitroList.js +9 -0
  10. package/lib/commonjs/NitroList.js.map +1 -0
  11. package/lib/commonjs/RecyclerList.internal.js +25 -0
  12. package/lib/commonjs/RecyclerList.internal.js.map +1 -0
  13. package/lib/commonjs/RecyclerList.js +171 -0
  14. package/lib/commonjs/RecyclerList.js.map +1 -0
  15. package/lib/commonjs/RecyclerList.types.js +6 -0
  16. package/lib/commonjs/RecyclerList.types.js.map +1 -0
  17. package/lib/commonjs/ReusableView.js +2 -0
  18. package/lib/commonjs/ReusableView.js.map +1 -0
  19. package/lib/commonjs/cell/Cell.js +2 -0
  20. package/lib/{module/specs/nitro-list.nitro.js.map → commonjs/cell/Cell.js.map} +1 -1
  21. package/lib/commonjs/cell/CellRecycler.js +62 -0
  22. package/lib/commonjs/cell/CellRecycler.js.map +1 -0
  23. package/lib/commonjs/cell/StableKey.js +10 -0
  24. package/lib/commonjs/cell/StableKey.js.map +1 -0
  25. package/lib/commonjs/debug/useDebugOverlay.js +15 -0
  26. package/lib/commonjs/debug/useDebugOverlay.js.map +1 -0
  27. package/lib/commonjs/getVisibleIndices.js +38 -0
  28. package/lib/commonjs/getVisibleIndices.js.map +1 -0
  29. package/lib/commonjs/hooks/useCellRenderer.js +62 -0
  30. package/lib/commonjs/hooks/useCellRenderer.js.map +1 -0
  31. package/lib/commonjs/hooks/useStableCallback.js +13 -0
  32. package/lib/commonjs/hooks/useStableCallback.js.map +1 -0
  33. package/lib/commonjs/index.js +7 -5
  34. package/lib/commonjs/index.js.map +1 -1
  35. package/lib/commonjs/layout/EstimatedLayoutProvider.js +30 -0
  36. package/lib/commonjs/layout/EstimatedLayoutProvider.js.map +1 -0
  37. package/lib/commonjs/layout/LayoutEngine.js +21 -0
  38. package/lib/commonjs/layout/LayoutEngine.js.map +1 -0
  39. package/lib/commonjs/{specs/nitro-list.nitro.js → layout/LayoutProvider.js} +1 -1
  40. package/lib/commonjs/{specs/nitro-list.nitro.js.map → layout/LayoutProvider.js.map} +1 -1
  41. package/lib/commonjs/layout/LayoutRectangle.js +2 -0
  42. package/lib/commonjs/layout/LayoutRectangle.js.map +1 -0
  43. package/lib/commonjs/layout/MutableLinearLayout.js +65 -0
  44. package/lib/commonjs/layout/MutableLinearLayout.js.map +1 -0
  45. package/lib/commonjs/layout/index.js +20 -0
  46. package/lib/commonjs/layout/index.js.map +1 -0
  47. package/lib/commonjs/measurement/MeasureLayout.js +20 -0
  48. package/lib/commonjs/measurement/MeasureLayout.js.map +1 -0
  49. package/lib/commonjs/measurement/useItemMeasurement.js +28 -0
  50. package/lib/commonjs/measurement/useItemMeasurement.js.map +1 -0
  51. package/lib/commonjs/native/NitroLayoutEngine.js +9 -0
  52. package/lib/commonjs/native/NitroLayoutEngine.js.map +1 -0
  53. package/lib/commonjs/native/NitroList.types.js +6 -0
  54. package/lib/commonjs/native/NitroList.types.js.map +1 -0
  55. package/lib/commonjs/native/NitroRecyclerView.js +9 -0
  56. package/lib/commonjs/native/NitroRecyclerView.js.map +1 -0
  57. package/lib/commonjs/prefetch/PrefetchHelper.js +39 -0
  58. package/lib/commonjs/prefetch/PrefetchHelper.js.map +1 -0
  59. package/lib/commonjs/specs/nitro-layout-engine.nitro.js +6 -0
  60. package/lib/commonjs/specs/nitro-layout-engine.nitro.js.map +1 -0
  61. package/lib/commonjs/utils/arrayEqual.js +15 -0
  62. package/lib/commonjs/utils/arrayEqual.js.map +1 -0
  63. package/lib/commonjs/utils/assertNever.js +10 -0
  64. package/lib/commonjs/utils/assertNever.js.map +1 -0
  65. package/lib/commonjs/utils/clamp.js +10 -0
  66. package/lib/commonjs/utils/clamp.js.map +1 -0
  67. package/lib/commonjs/utils/devAssert.js +12 -0
  68. package/lib/commonjs/utils/devAssert.js.map +1 -0
  69. package/lib/commonjs/utils/invariant.js +12 -0
  70. package/lib/commonjs/utils/invariant.js.map +1 -0
  71. package/lib/commonjs/utils/isDefined.js +10 -0
  72. package/lib/commonjs/utils/isDefined.js.map +1 -0
  73. package/lib/commonjs/utils/isNumber.js +10 -0
  74. package/lib/commonjs/utils/isNumber.js.map +1 -0
  75. package/lib/commonjs/utils/noop.js +10 -0
  76. package/lib/commonjs/utils/noop.js.map +1 -0
  77. package/lib/commonjs/utils/shallowEqual.js +22 -0
  78. package/lib/commonjs/utils/shallowEqual.js.map +1 -0
  79. package/lib/commonjs/utils/throttle.js +17 -0
  80. package/lib/commonjs/utils/throttle.js.map +1 -0
  81. package/lib/commonjs/viewability/ViewabilityHelper.js +121 -0
  82. package/lib/commonjs/viewability/ViewabilityHelper.js.map +1 -0
  83. package/lib/commonjs/windowing/ScrollMetrics.js +2 -0
  84. package/lib/commonjs/windowing/ScrollMetrics.js.map +1 -0
  85. package/lib/commonjs/windowing/findVisibleIndexRange.js +48 -0
  86. package/lib/commonjs/windowing/findVisibleIndexRange.js.map +1 -0
  87. package/lib/commonjs/windowing/index.js +20 -0
  88. package/lib/commonjs/windowing/index.js.map +1 -0
  89. package/lib/commonjs/windowing/useScrollMetrics.js +39 -0
  90. package/lib/commonjs/windowing/useScrollMetrics.js.map +1 -0
  91. package/lib/module/NitroList.js +5 -0
  92. package/lib/module/NitroList.js.map +1 -0
  93. package/lib/module/RecyclerList.internal.js +22 -0
  94. package/lib/module/RecyclerList.internal.js.map +1 -0
  95. package/lib/module/RecyclerList.js +166 -0
  96. package/lib/module/RecyclerList.js.map +1 -0
  97. package/lib/module/RecyclerList.types.js +4 -0
  98. package/lib/module/RecyclerList.types.js.map +1 -0
  99. package/lib/module/ReusableView.js +2 -0
  100. package/lib/module/ReusableView.js.map +1 -0
  101. package/lib/module/cell/Cell.js +2 -0
  102. package/lib/module/cell/Cell.js.map +1 -0
  103. package/lib/module/cell/CellRecycler.js +57 -0
  104. package/lib/module/cell/CellRecycler.js.map +1 -0
  105. package/lib/module/cell/StableKey.js +6 -0
  106. package/lib/module/cell/StableKey.js.map +1 -0
  107. package/lib/module/debug/useDebugOverlay.js +11 -0
  108. package/lib/module/debug/useDebugOverlay.js.map +1 -0
  109. package/lib/module/getVisibleIndices.js +34 -0
  110. package/lib/module/getVisibleIndices.js.map +1 -0
  111. package/lib/module/hooks/useCellRenderer.js +58 -0
  112. package/lib/module/hooks/useCellRenderer.js.map +1 -0
  113. package/lib/module/hooks/useStableCallback.js +9 -0
  114. package/lib/module/hooks/useStableCallback.js.map +1 -0
  115. package/lib/module/index.js +1 -3
  116. package/lib/module/index.js.map +1 -1
  117. package/lib/module/layout/EstimatedLayoutProvider.js +25 -0
  118. package/lib/module/layout/EstimatedLayoutProvider.js.map +1 -0
  119. package/lib/module/layout/LayoutEngine.js +17 -0
  120. package/lib/module/layout/LayoutEngine.js.map +1 -0
  121. package/lib/module/layout/LayoutProvider.js +4 -0
  122. package/lib/module/layout/LayoutProvider.js.map +1 -0
  123. package/lib/module/layout/LayoutRectangle.js +2 -0
  124. package/lib/module/layout/LayoutRectangle.js.map +1 -0
  125. package/lib/module/layout/MutableLinearLayout.js +60 -0
  126. package/lib/module/layout/MutableLinearLayout.js.map +1 -0
  127. package/lib/module/layout/index.js +5 -0
  128. package/lib/module/layout/index.js.map +1 -0
  129. package/lib/module/measurement/MeasureLayout.js +16 -0
  130. package/lib/module/measurement/MeasureLayout.js.map +1 -0
  131. package/lib/module/measurement/useItemMeasurement.js +24 -0
  132. package/lib/module/measurement/useItemMeasurement.js.map +1 -0
  133. package/lib/module/native/NitroLayoutEngine.js +5 -0
  134. package/lib/module/native/NitroLayoutEngine.js.map +1 -0
  135. package/lib/module/native/NitroList.types.js +4 -0
  136. package/lib/module/native/NitroList.types.js.map +1 -0
  137. package/lib/module/native/NitroRecyclerView.js +5 -0
  138. package/lib/module/native/NitroRecyclerView.js.map +1 -0
  139. package/lib/module/prefetch/PrefetchHelper.js +34 -0
  140. package/lib/module/prefetch/PrefetchHelper.js.map +1 -0
  141. package/lib/module/specs/nitro-layout-engine.nitro.js +4 -0
  142. package/lib/module/specs/nitro-layout-engine.nitro.js.map +1 -0
  143. package/lib/module/utils/arrayEqual.js +11 -0
  144. package/lib/module/utils/arrayEqual.js.map +1 -0
  145. package/lib/module/utils/assertNever.js +6 -0
  146. package/lib/module/utils/assertNever.js.map +1 -0
  147. package/lib/module/utils/clamp.js +6 -0
  148. package/lib/module/utils/clamp.js.map +1 -0
  149. package/lib/module/utils/devAssert.js +8 -0
  150. package/lib/module/utils/devAssert.js.map +1 -0
  151. package/lib/module/utils/invariant.js +8 -0
  152. package/lib/module/utils/invariant.js.map +1 -0
  153. package/lib/module/utils/isDefined.js +6 -0
  154. package/lib/module/utils/isDefined.js.map +1 -0
  155. package/lib/module/utils/isNumber.js +6 -0
  156. package/lib/module/utils/isNumber.js.map +1 -0
  157. package/lib/module/utils/noop.js +6 -0
  158. package/lib/module/utils/noop.js.map +1 -0
  159. package/lib/module/utils/shallowEqual.js +18 -0
  160. package/lib/module/utils/shallowEqual.js.map +1 -0
  161. package/lib/module/utils/throttle.js +13 -0
  162. package/lib/module/utils/throttle.js.map +1 -0
  163. package/lib/module/viewability/ViewabilityHelper.js +116 -0
  164. package/lib/module/viewability/ViewabilityHelper.js.map +1 -0
  165. package/lib/module/windowing/ScrollMetrics.js +2 -0
  166. package/lib/module/windowing/ScrollMetrics.js.map +1 -0
  167. package/lib/module/windowing/findVisibleIndexRange.js +44 -0
  168. package/lib/module/windowing/findVisibleIndexRange.js.map +1 -0
  169. package/lib/module/windowing/index.js +5 -0
  170. package/lib/module/windowing/index.js.map +1 -0
  171. package/lib/module/windowing/useScrollMetrics.js +35 -0
  172. package/lib/module/windowing/useScrollMetrics.js.map +1 -0
  173. package/lib/typescript/src/NitroList.d.ts +5 -0
  174. package/lib/typescript/src/NitroList.d.ts.map +1 -0
  175. package/lib/typescript/src/RecyclerList.d.ts +26 -0
  176. package/lib/typescript/src/RecyclerList.d.ts.map +1 -0
  177. package/lib/typescript/src/RecyclerList.internal.d.ts +9 -0
  178. package/lib/typescript/src/RecyclerList.internal.d.ts.map +1 -0
  179. package/lib/typescript/src/RecyclerList.types.d.ts +18 -0
  180. package/lib/typescript/src/RecyclerList.types.d.ts.map +1 -0
  181. package/lib/typescript/src/ReusableView.d.ts +9 -0
  182. package/lib/typescript/src/ReusableView.d.ts.map +1 -0
  183. package/lib/typescript/src/__tests__/windowing/findVisibleIndexRange.test.d.ts +2 -0
  184. package/lib/typescript/src/__tests__/windowing/findVisibleIndexRange.test.d.ts.map +1 -0
  185. package/lib/typescript/src/cell/Cell.d.ts +13 -0
  186. package/lib/typescript/src/cell/Cell.d.ts.map +1 -0
  187. package/lib/typescript/src/cell/CellRecycler.d.ts +19 -0
  188. package/lib/typescript/src/cell/CellRecycler.d.ts.map +1 -0
  189. package/lib/typescript/src/cell/StableKey.d.ts +2 -0
  190. package/lib/typescript/src/cell/StableKey.d.ts.map +1 -0
  191. package/lib/typescript/src/debug/useDebugOverlay.d.ts +2 -0
  192. package/lib/typescript/src/debug/useDebugOverlay.d.ts.map +1 -0
  193. package/lib/typescript/src/getVisibleIndices.d.ts +8 -0
  194. package/lib/typescript/src/getVisibleIndices.d.ts.map +1 -0
  195. package/lib/typescript/src/hooks/useCellRenderer.d.ts +19 -0
  196. package/lib/typescript/src/hooks/useCellRenderer.d.ts.map +1 -0
  197. package/lib/typescript/src/hooks/useStableCallback.d.ts +2 -0
  198. package/lib/typescript/src/hooks/useStableCallback.d.ts.map +1 -0
  199. package/lib/typescript/src/index.d.ts +2 -4
  200. package/lib/typescript/src/index.d.ts.map +1 -1
  201. package/lib/typescript/src/layout/EstimatedLayoutProvider.d.ts +15 -0
  202. package/lib/typescript/src/layout/EstimatedLayoutProvider.d.ts.map +1 -0
  203. package/lib/typescript/src/layout/LayoutEngine.d.ts +10 -0
  204. package/lib/typescript/src/layout/LayoutEngine.d.ts.map +1 -0
  205. package/lib/typescript/src/layout/LayoutProvider.d.ts +16 -0
  206. package/lib/typescript/src/layout/LayoutProvider.d.ts.map +1 -0
  207. package/lib/typescript/src/layout/LayoutRectangle.d.ts +11 -0
  208. package/lib/typescript/src/layout/LayoutRectangle.d.ts.map +1 -0
  209. package/lib/typescript/src/layout/MutableLinearLayout.d.ts +22 -0
  210. package/lib/typescript/src/layout/MutableLinearLayout.d.ts.map +1 -0
  211. package/lib/typescript/src/layout/index.d.ts +5 -0
  212. package/lib/typescript/src/layout/index.d.ts.map +1 -0
  213. package/lib/typescript/src/measurement/MeasureLayout.d.ts +10 -0
  214. package/lib/typescript/src/measurement/MeasureLayout.d.ts.map +1 -0
  215. package/lib/typescript/src/measurement/useItemMeasurement.d.ts +11 -0
  216. package/lib/typescript/src/measurement/useItemMeasurement.d.ts.map +1 -0
  217. package/lib/typescript/src/native/NitroLayoutEngine.d.ts +3 -0
  218. package/lib/typescript/src/native/NitroLayoutEngine.d.ts.map +1 -0
  219. package/lib/typescript/src/native/NitroList.types.d.ts +9 -0
  220. package/lib/typescript/src/native/NitroList.types.d.ts.map +1 -0
  221. package/lib/typescript/src/native/NitroRecyclerView.d.ts +5 -0
  222. package/lib/typescript/src/native/NitroRecyclerView.d.ts.map +1 -0
  223. package/lib/typescript/src/prefetch/PrefetchHelper.d.ts +17 -0
  224. package/lib/typescript/src/prefetch/PrefetchHelper.d.ts.map +1 -0
  225. package/lib/typescript/src/specs/nitro-layout-engine.nitro.d.ts +14 -0
  226. package/lib/typescript/src/specs/nitro-layout-engine.nitro.d.ts.map +1 -0
  227. package/lib/typescript/src/utils/arrayEqual.d.ts +2 -0
  228. package/lib/typescript/src/utils/arrayEqual.d.ts.map +1 -0
  229. package/lib/typescript/src/utils/assertNever.d.ts +2 -0
  230. package/lib/typescript/src/utils/assertNever.d.ts.map +1 -0
  231. package/lib/typescript/src/utils/clamp.d.ts +2 -0
  232. package/lib/typescript/src/utils/clamp.d.ts.map +1 -0
  233. package/lib/typescript/src/utils/devAssert.d.ts +2 -0
  234. package/lib/typescript/src/utils/devAssert.d.ts.map +1 -0
  235. package/lib/typescript/src/utils/invariant.d.ts +2 -0
  236. package/lib/typescript/src/utils/invariant.d.ts.map +1 -0
  237. package/lib/typescript/src/utils/isDefined.d.ts +2 -0
  238. package/lib/typescript/src/utils/isDefined.d.ts.map +1 -0
  239. package/lib/typescript/src/utils/isNumber.d.ts +2 -0
  240. package/lib/typescript/src/utils/isNumber.d.ts.map +1 -0
  241. package/lib/typescript/src/utils/noop.d.ts +2 -0
  242. package/lib/typescript/src/utils/noop.d.ts.map +1 -0
  243. package/lib/typescript/src/utils/shallowEqual.d.ts +2 -0
  244. package/lib/typescript/src/utils/shallowEqual.d.ts.map +1 -0
  245. package/lib/typescript/src/utils/throttle.d.ts +2 -0
  246. package/lib/typescript/src/utils/throttle.d.ts.map +1 -0
  247. package/lib/typescript/src/viewability/ViewabilityHelper.d.ts +50 -0
  248. package/lib/typescript/src/viewability/ViewabilityHelper.d.ts.map +1 -0
  249. package/lib/typescript/src/windowing/ScrollMetrics.d.ts +11 -0
  250. package/lib/typescript/src/windowing/ScrollMetrics.d.ts.map +1 -0
  251. package/lib/typescript/src/windowing/findVisibleIndexRange.d.ts +11 -0
  252. package/lib/typescript/src/windowing/findVisibleIndexRange.d.ts.map +1 -0
  253. package/lib/typescript/src/windowing/index.d.ts +4 -0
  254. package/lib/typescript/src/windowing/index.d.ts.map +1 -0
  255. package/lib/typescript/src/windowing/useScrollMetrics.d.ts +14 -0
  256. package/lib/typescript/src/windowing/useScrollMetrics.d.ts.map +1 -0
  257. package/nitro.json +20 -13
  258. package/nitrogen/generated/android/NitroList+autolinking.cmake +2 -4
  259. package/nitrogen/generated/android/NitroListOnLoad.cpp +3 -13
  260. package/nitrogen/generated/android/c++/JHybridNitroLayoutEngineSpec.cpp +69 -0
  261. package/nitrogen/generated/android/c++/{JHybridNitroListSpec.hpp → JHybridNitroLayoutEngineSpec.hpp} +12 -13
  262. package/nitrogen/generated/android/c++/JLayoutRectangle.hpp +69 -0
  263. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrolist/{HybridNitroListSpec.kt → HybridNitroLayoutEngineSpec.kt} +11 -13
  264. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrolist/LayoutRectangle.kt +47 -0
  265. package/nitrogen/generated/ios/NitroList-Swift-Cxx-Bridge.cpp +9 -9
  266. package/nitrogen/generated/ios/NitroList-Swift-Cxx-Bridge.hpp +50 -13
  267. package/nitrogen/generated/ios/NitroList-Swift-Cxx-Umbrella.hpp +11 -5
  268. package/nitrogen/generated/ios/c++/{HybridNitroListSpecSwift.cpp → HybridNitroLayoutEngineSpecSwift.cpp} +2 -2
  269. package/nitrogen/generated/ios/c++/HybridNitroLayoutEngineSpecSwift.hpp +78 -0
  270. package/nitrogen/generated/ios/swift/HybridNitroLayoutEngineSpec.swift +56 -0
  271. package/nitrogen/generated/ios/swift/{HybridNitroListSpec_cxx.swift → HybridNitroLayoutEngineSpec_cxx.swift} +35 -38
  272. package/nitrogen/generated/ios/swift/LayoutRectangle.swift +45 -0
  273. package/nitrogen/generated/shared/c++/{HybridNitroListSpec.cpp → HybridNitroLayoutEngineSpec.cpp} +4 -5
  274. package/nitrogen/generated/shared/c++/{HybridNitroListSpec.hpp → HybridNitroLayoutEngineSpec.hpp} +15 -14
  275. package/nitrogen/generated/shared/c++/LayoutRectangle.hpp +95 -0
  276. package/package.json +12 -4
  277. package/src/NitroList.ts +8 -0
  278. package/src/RecyclerList.internal.ts +38 -0
  279. package/src/RecyclerList.tsx +252 -0
  280. package/src/RecyclerList.types.ts +24 -0
  281. package/src/ReusableView.ts +12 -0
  282. package/src/__tests__/windowing/findVisibleIndexRange.test.ts +55 -0
  283. package/src/cell/Cell.ts +14 -0
  284. package/src/cell/CellRecycler.ts +66 -0
  285. package/src/cell/StableKey.ts +6 -0
  286. package/src/debug/useDebugOverlay.ts +14 -0
  287. package/src/getVisibleIndices.ts +53 -0
  288. package/src/hooks/useCellRenderer.ts +86 -0
  289. package/src/hooks/useStableCallback.ts +13 -0
  290. package/src/index.ts +2 -14
  291. package/src/layout/EstimatedLayoutProvider.ts +35 -0
  292. package/src/layout/LayoutEngine.ts +21 -0
  293. package/src/layout/LayoutProvider.ts +17 -0
  294. package/src/layout/LayoutRectangle.ts +10 -0
  295. package/src/layout/MutableLinearLayout.ts +79 -0
  296. package/src/layout/index.ts +4 -0
  297. package/src/measurement/MeasureLayout.ts +20 -0
  298. package/src/measurement/useItemMeasurement.ts +32 -0
  299. package/src/native/NitroLayoutEngine.ts +7 -0
  300. package/src/native/NitroList.types.ts +12 -0
  301. package/src/native/NitroRecyclerView.ts +8 -0
  302. package/src/prefetch/PrefetchHelper.ts +47 -0
  303. package/src/specs/nitro-layout-engine.nitro.ts +17 -0
  304. package/src/utils/arrayEqual.ts +13 -0
  305. package/src/utils/assertNever.ts +3 -0
  306. package/src/utils/clamp.ts +7 -0
  307. package/src/utils/devAssert.ts +8 -0
  308. package/src/utils/invariant.ts +8 -0
  309. package/src/utils/isDefined.ts +5 -0
  310. package/src/utils/isNumber.ts +3 -0
  311. package/src/utils/noop.ts +3 -0
  312. package/src/utils/shallowEqual.ts +34 -0
  313. package/src/utils/throttle.ts +13 -0
  314. package/src/viewability/ViewabilityHelper.ts +130 -0
  315. package/src/windowing/ScrollMetrics.ts +11 -0
  316. package/src/windowing/findVisibleIndexRange.ts +60 -0
  317. package/src/windowing/index.ts +3 -0
  318. package/src/windowing/useScrollMetrics.ts +56 -0
  319. package/android/src/main/java/com/nitrolist/HybridNitroList.kt +0 -27
  320. package/lib/module/specs/nitro-list.nitro.js +0 -4
  321. package/lib/typescript/src/specs/nitro-list.nitro.d.ts +0 -11
  322. package/lib/typescript/src/specs/nitro-list.nitro.d.ts.map +0 -1
  323. package/nitrogen/generated/android/c++/JHybridNitroListSpec.cpp +0 -56
  324. package/nitrogen/generated/android/c++/views/JHybridNitroListStateUpdater.cpp +0 -56
  325. package/nitrogen/generated/android/c++/views/JHybridNitroListStateUpdater.hpp +0 -49
  326. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrolist/views/HybridNitroListManager.kt +0 -50
  327. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrolist/views/HybridNitroListStateUpdater.kt +0 -23
  328. package/nitrogen/generated/ios/NitroListAutolinking.mm +0 -33
  329. package/nitrogen/generated/ios/NitroListAutolinking.swift +0 -25
  330. package/nitrogen/generated/ios/c++/HybridNitroListSpecSwift.hpp +0 -74
  331. package/nitrogen/generated/ios/c++/views/HybridNitroListComponent.mm +0 -96
  332. package/nitrogen/generated/ios/swift/HybridNitroListSpec.swift +0 -56
  333. package/nitrogen/generated/shared/c++/views/HybridNitroListComponent.cpp +0 -88
  334. package/nitrogen/generated/shared/c++/views/HybridNitroListComponent.hpp +0 -107
  335. package/nitrogen/generated/shared/json/NitroListConfig.json +0 -10
  336. package/src/specs/nitro-list.nitro.ts +0 -13
@@ -1,5 +1,5 @@
1
1
  ///
2
- /// HybridNitroListSpec_cxx.swift
2
+ /// HybridNitroLayoutEngineSpec_cxx.swift
3
3
  /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
4
  /// https://github.com/mrousavy/nitro
5
5
  /// Copyright © 2025 Marc Rousavy @ Margelo
@@ -9,7 +9,7 @@ import Foundation
9
9
  import NitroModules
10
10
 
11
11
  /**
12
- * A class implementation that bridges HybridNitroListSpec over to C++.
12
+ * A class implementation that bridges HybridNitroLayoutEngineSpec over to C++.
13
13
  * In C++, we cannot use Swift protocols - so we need to wrap it in a class to make it strongly defined.
14
14
  *
15
15
  * Also, some Swift types need to be bridged with special handling:
@@ -17,7 +17,7 @@ import NitroModules
17
17
  * - Other HybridObjects need to be wrapped/unwrapped from the Swift TCxx wrapper
18
18
  * - Throwing methods need to be wrapped with a Result<T, Error> type, as exceptions cannot be propagated to C++
19
19
  */
20
- open class HybridNitroListSpec_cxx {
20
+ open class HybridNitroLayoutEngineSpec_cxx {
21
21
  /**
22
22
  * The Swift <> C++ bridge's namespace (`margelo::nitro::nitrolist::bridge::swift`)
23
23
  * from `NitroList-Swift-Cxx-Bridge.hpp`.
@@ -26,30 +26,30 @@ open class HybridNitroListSpec_cxx {
26
26
  public typealias bridge = margelo.nitro.nitrolist.bridge.swift
27
27
 
28
28
  /**
29
- * Holds an instance of the `HybridNitroListSpec` Swift protocol.
29
+ * Holds an instance of the `HybridNitroLayoutEngineSpec` Swift protocol.
30
30
  */
31
- private var __implementation: any HybridNitroListSpec
31
+ private var __implementation: any HybridNitroLayoutEngineSpec
32
32
 
33
33
  /**
34
34
  * Holds a weak pointer to the C++ class that wraps the Swift class.
35
35
  */
36
- private var __cxxPart: bridge.std__weak_ptr_HybridNitroListSpec_
36
+ private var __cxxPart: bridge.std__weak_ptr_HybridNitroLayoutEngineSpec_
37
37
 
38
38
  /**
39
- * Create a new `HybridNitroListSpec_cxx` that wraps the given `HybridNitroListSpec`.
39
+ * Create a new `HybridNitroLayoutEngineSpec_cxx` that wraps the given `HybridNitroLayoutEngineSpec`.
40
40
  * All properties and methods bridge to C++ types.
41
41
  */
42
- public init(_ implementation: any HybridNitroListSpec) {
42
+ public init(_ implementation: any HybridNitroLayoutEngineSpec) {
43
43
  self.__implementation = implementation
44
44
  self.__cxxPart = .init()
45
45
  /* no base class */
46
46
  }
47
47
 
48
48
  /**
49
- * Get the actual `HybridNitroListSpec` instance this class wraps.
49
+ * Get the actual `HybridNitroLayoutEngineSpec` instance this class wraps.
50
50
  */
51
51
  @inline(__always)
52
- public func getHybridNitroListSpec() -> any HybridNitroListSpec {
52
+ public func getHybridNitroLayoutEngineSpec() -> any HybridNitroLayoutEngineSpec {
53
53
  return __implementation
54
54
  }
55
55
 
@@ -62,25 +62,25 @@ open class HybridNitroListSpec_cxx {
62
62
  }
63
63
 
64
64
  /**
65
- * Casts an unsafe pointer to a `HybridNitroListSpec_cxx`.
66
- * The pointer has to be a retained opaque `Unmanaged<HybridNitroListSpec_cxx>`.
65
+ * Casts an unsafe pointer to a `HybridNitroLayoutEngineSpec_cxx`.
66
+ * The pointer has to be a retained opaque `Unmanaged<HybridNitroLayoutEngineSpec_cxx>`.
67
67
  * This removes one strong reference from the object!
68
68
  */
69
- public class func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> HybridNitroListSpec_cxx {
70
- return Unmanaged<HybridNitroListSpec_cxx>.fromOpaque(pointer).takeRetainedValue()
69
+ public class func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> HybridNitroLayoutEngineSpec_cxx {
70
+ return Unmanaged<HybridNitroLayoutEngineSpec_cxx>.fromOpaque(pointer).takeRetainedValue()
71
71
  }
72
72
 
73
73
  /**
74
74
  * Gets (or creates) the C++ part of this Hybrid Object.
75
- * The C++ part is a `std::shared_ptr<HybridNitroListSpec>`.
75
+ * The C++ part is a `std::shared_ptr<HybridNitroLayoutEngineSpec>`.
76
76
  */
77
- public func getCxxPart() -> bridge.std__shared_ptr_HybridNitroListSpec_ {
77
+ public func getCxxPart() -> bridge.std__shared_ptr_HybridNitroLayoutEngineSpec_ {
78
78
  let cachedCxxPart = self.__cxxPart.lock()
79
79
  if Bool(fromCxx: cachedCxxPart) {
80
80
  return cachedCxxPart
81
81
  } else {
82
- let newCxxPart = bridge.create_std__shared_ptr_HybridNitroListSpec_(self.toUnsafe())
83
- __cxxPart = bridge.weakify_std__shared_ptr_HybridNitroListSpec_(newCxxPart)
82
+ let newCxxPart = bridge.create_std__shared_ptr_HybridNitroLayoutEngineSpec_(self.toUnsafe())
83
+ __cxxPart = bridge.weakify_std__shared_ptr_HybridNitroLayoutEngineSpec_(newCxxPart)
84
84
  return newCxxPart
85
85
  }
86
86
  }
@@ -114,27 +114,24 @@ open class HybridNitroListSpec_cxx {
114
114
  }
115
115
 
116
116
  // Properties
117
- public final var isRed: Bool {
118
- @inline(__always)
119
- get {
120
- return self.__implementation.isRed
121
- }
122
- @inline(__always)
123
- set {
124
- self.__implementation.isRed = newValue
125
- }
126
- }
117
+
127
118
 
128
119
  // Methods
129
- public final func getView() -> UnsafeMutableRawPointer {
130
- return Unmanaged.passRetained(__implementation.view).toOpaque()
131
- }
132
-
133
- public final func beforeUpdate() {
134
- __implementation.beforeUpdate()
135
- }
136
-
137
- public final func afterUpdate() {
138
- __implementation.afterUpdate()
120
+ @inline(__always)
121
+ public final func computeLayout(containerWidth: Double, itemHeights: bridge.std__vector_double_) -> bridge.Result_std__vector_LayoutRectangle__ {
122
+ do {
123
+ let __result = try self.__implementation.computeLayout(containerWidth: containerWidth, itemHeights: itemHeights.map({ __item in __item }))
124
+ let __resultCpp = { () -> bridge.std__vector_LayoutRectangle_ in
125
+ var __vector = bridge.create_std__vector_LayoutRectangle_(__result.count)
126
+ for __item in __result {
127
+ __vector.push_back(__item)
128
+ }
129
+ return __vector
130
+ }()
131
+ return bridge.create_Result_std__vector_LayoutRectangle__(__resultCpp)
132
+ } catch (let __error) {
133
+ let __exceptionPtr = __error.toCpp()
134
+ return bridge.create_Result_std__vector_LayoutRectangle__(__exceptionPtr)
135
+ }
139
136
  }
140
137
  }
@@ -0,0 +1,45 @@
1
+ ///
2
+ /// LayoutRectangle.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
+ /**
12
+ * Represents an instance of `LayoutRectangle`, backed by a C++ struct.
13
+ */
14
+ public typealias LayoutRectangle = margelo.nitro.nitrolist.LayoutRectangle
15
+
16
+ public extension LayoutRectangle {
17
+ private typealias bridge = margelo.nitro.nitrolist.bridge.swift
18
+
19
+ /**
20
+ * Create a new instance of `LayoutRectangle`.
21
+ */
22
+ init(x: Double, y: Double, width: Double, height: Double) {
23
+ self.init(x, y, width, height)
24
+ }
25
+
26
+ @inline(__always)
27
+ var x: Double {
28
+ return self.__x
29
+ }
30
+
31
+ @inline(__always)
32
+ var y: Double {
33
+ return self.__y
34
+ }
35
+
36
+ @inline(__always)
37
+ var width: Double {
38
+ return self.__width
39
+ }
40
+
41
+ @inline(__always)
42
+ var height: Double {
43
+ return self.__height
44
+ }
45
+ }
@@ -1,21 +1,20 @@
1
1
  ///
2
- /// HybridNitroListSpec.cpp
2
+ /// HybridNitroLayoutEngineSpec.cpp
3
3
  /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
4
  /// https://github.com/mrousavy/nitro
5
5
  /// Copyright © 2025 Marc Rousavy @ Margelo
6
6
  ///
7
7
 
8
- #include "HybridNitroListSpec.hpp"
8
+ #include "HybridNitroLayoutEngineSpec.hpp"
9
9
 
10
10
  namespace margelo::nitro::nitrolist {
11
11
 
12
- void HybridNitroListSpec::loadHybridMethods() {
12
+ void HybridNitroLayoutEngineSpec::loadHybridMethods() {
13
13
  // load base methods/properties
14
14
  HybridObject::loadHybridMethods();
15
15
  // load custom methods/properties
16
16
  registerHybrids(this, [](Prototype& prototype) {
17
- prototype.registerHybridGetter("isRed", &HybridNitroListSpec::getIsRed);
18
- prototype.registerHybridSetter("isRed", &HybridNitroListSpec::setIsRed);
17
+ prototype.registerHybridMethod("computeLayout", &HybridNitroLayoutEngineSpec::computeLayout);
19
18
  });
20
19
  }
21
20
 
@@ -1,5 +1,5 @@
1
1
  ///
2
- /// HybridNitroListSpec.hpp
2
+ /// HybridNitroLayoutEngineSpec.hpp
3
3
  /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
4
  /// https://github.com/mrousavy/nitro
5
5
  /// Copyright © 2025 Marc Rousavy @ Margelo
@@ -13,43 +13,44 @@
13
13
  #error NitroModules cannot be found! Are you sure you installed NitroModules properly?
14
14
  #endif
15
15
 
16
+ // Forward declaration of `LayoutRectangle` to properly resolve imports.
17
+ namespace margelo::nitro::nitrolist { struct LayoutRectangle; }
16
18
 
17
-
18
-
19
+ #include "LayoutRectangle.hpp"
20
+ #include <vector>
19
21
 
20
22
  namespace margelo::nitro::nitrolist {
21
23
 
22
24
  using namespace margelo::nitro;
23
25
 
24
26
  /**
25
- * An abstract base class for `NitroList`
26
- * Inherit this class to create instances of `HybridNitroListSpec` in C++.
27
+ * An abstract base class for `NitroLayoutEngine`
28
+ * Inherit this class to create instances of `HybridNitroLayoutEngineSpec` in C++.
27
29
  * You must explicitly call `HybridObject`'s constructor yourself, because it is virtual.
28
30
  * @example
29
31
  * ```cpp
30
- * class HybridNitroList: public HybridNitroListSpec {
32
+ * class HybridNitroLayoutEngine: public HybridNitroLayoutEngineSpec {
31
33
  * public:
32
- * HybridNitroList(...): HybridObject(TAG) { ... }
34
+ * HybridNitroLayoutEngine(...): HybridObject(TAG) { ... }
33
35
  * // ...
34
36
  * };
35
37
  * ```
36
38
  */
37
- class HybridNitroListSpec: public virtual HybridObject {
39
+ class HybridNitroLayoutEngineSpec: public virtual HybridObject {
38
40
  public:
39
41
  // Constructor
40
- explicit HybridNitroListSpec(): HybridObject(TAG) { }
42
+ explicit HybridNitroLayoutEngineSpec(): HybridObject(TAG) { }
41
43
 
42
44
  // Destructor
43
- ~HybridNitroListSpec() override = default;
45
+ ~HybridNitroLayoutEngineSpec() override = default;
44
46
 
45
47
  public:
46
48
  // Properties
47
- virtual bool getIsRed() = 0;
48
- virtual void setIsRed(bool isRed) = 0;
49
+
49
50
 
50
51
  public:
51
52
  // Methods
52
-
53
+ virtual std::vector<LayoutRectangle> computeLayout(double containerWidth, const std::vector<double>& itemHeights) = 0;
53
54
 
54
55
  protected:
55
56
  // Hybrid Setup
@@ -57,7 +58,7 @@ namespace margelo::nitro::nitrolist {
57
58
 
58
59
  protected:
59
60
  // Tag for logging
60
- static constexpr auto TAG = "NitroList";
61
+ static constexpr auto TAG = "NitroLayoutEngine";
61
62
  };
62
63
 
63
64
  } // namespace margelo::nitro::nitrolist
@@ -0,0 +1,95 @@
1
+ ///
2
+ /// LayoutRectangle.hpp
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
+ #pragma once
9
+
10
+ #if __has_include(<NitroModules/JSIConverter.hpp>)
11
+ #include <NitroModules/JSIConverter.hpp>
12
+ #else
13
+ #error NitroModules cannot be found! Are you sure you installed NitroModules properly?
14
+ #endif
15
+ #if __has_include(<NitroModules/NitroDefines.hpp>)
16
+ #include <NitroModules/NitroDefines.hpp>
17
+ #else
18
+ #error NitroModules cannot be found! Are you sure you installed NitroModules properly?
19
+ #endif
20
+ #if __has_include(<NitroModules/JSIHelpers.hpp>)
21
+ #include <NitroModules/JSIHelpers.hpp>
22
+ #else
23
+ #error NitroModules cannot be found! Are you sure you installed NitroModules properly?
24
+ #endif
25
+ #if __has_include(<NitroModules/PropNameIDCache.hpp>)
26
+ #include <NitroModules/PropNameIDCache.hpp>
27
+ #else
28
+ #error NitroModules cannot be found! Are you sure you installed NitroModules properly?
29
+ #endif
30
+
31
+
32
+
33
+
34
+
35
+ namespace margelo::nitro::nitrolist {
36
+
37
+ /**
38
+ * A struct which can be represented as a JavaScript object (LayoutRectangle).
39
+ */
40
+ struct LayoutRectangle final {
41
+ public:
42
+ double x SWIFT_PRIVATE;
43
+ double y SWIFT_PRIVATE;
44
+ double width SWIFT_PRIVATE;
45
+ double height SWIFT_PRIVATE;
46
+
47
+ public:
48
+ LayoutRectangle() = default;
49
+ explicit LayoutRectangle(double x, double y, double width, double height): x(x), y(y), width(width), height(height) {}
50
+
51
+ public:
52
+ friend bool operator==(const LayoutRectangle& lhs, const LayoutRectangle& rhs) = default;
53
+ };
54
+
55
+ } // namespace margelo::nitro::nitrolist
56
+
57
+ namespace margelo::nitro {
58
+
59
+ // C++ LayoutRectangle <> JS LayoutRectangle (object)
60
+ template <>
61
+ struct JSIConverter<margelo::nitro::nitrolist::LayoutRectangle> final {
62
+ static inline margelo::nitro::nitrolist::LayoutRectangle fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
63
+ jsi::Object obj = arg.asObject(runtime);
64
+ return margelo::nitro::nitrolist::LayoutRectangle(
65
+ JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "x"))),
66
+ JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "y"))),
67
+ JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "width"))),
68
+ JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "height")))
69
+ );
70
+ }
71
+ static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::nitrolist::LayoutRectangle& arg) {
72
+ jsi::Object obj(runtime);
73
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "x"), JSIConverter<double>::toJSI(runtime, arg.x));
74
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "y"), JSIConverter<double>::toJSI(runtime, arg.y));
75
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "width"), JSIConverter<double>::toJSI(runtime, arg.width));
76
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "height"), JSIConverter<double>::toJSI(runtime, arg.height));
77
+ return obj;
78
+ }
79
+ static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
80
+ if (!value.isObject()) {
81
+ return false;
82
+ }
83
+ jsi::Object obj = value.getObject(runtime);
84
+ if (!nitro::isPlainObject(runtime, obj)) {
85
+ return false;
86
+ }
87
+ if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "x")))) return false;
88
+ if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "y")))) return false;
89
+ if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "width")))) return false;
90
+ if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "height")))) return false;
91
+ return true;
92
+ }
93
+ };
94
+
95
+ } // namespace margelo::nitro
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-nitro-list",
3
- "version": "0.0.1",
3
+ "version": "0.1.1",
4
4
  "description": "react-native-nitro-list is a react native package built with Nitro",
5
5
  "main": "./lib/commonjs/index.js",
6
6
  "module": "./lib/module/index.js",
@@ -8,6 +8,9 @@
8
8
  "react-native": "src/index",
9
9
  "source": "src/index",
10
10
  "scripts": {
11
+ "publish:release": "./scripts/publish.sh",
12
+ "test": "npx jest --passWithNoTests",
13
+ "test:watch": "npx jest --watch",
11
14
  "typecheck": "tsc --noEmit",
12
15
  "clean": "git clean -dfX",
13
16
  "release": "semantic-release",
@@ -57,12 +60,14 @@
57
60
  "@semantic-release/git": "^10.0.1",
58
61
  "@types/jest": "^29.5.12",
59
62
  "@types/react": "19.2.0",
60
- "nitrogen": "0.32.0",
63
+ "conventional-changelog-conventionalcommits": "^9.1.0",
64
+ "jest-environment-jsdom": "^30.2.0",
65
+ "nitrogen": "^0.32.0",
61
66
  "react": "19.2.0",
62
67
  "react-native": "0.83",
63
68
  "react-native-builder-bob": "^0.40.17",
64
69
  "react-native-nitro-modules": "0.32.0",
65
- "conventional-changelog-conventionalcommits": "^9.1.0",
70
+ "react-test-renderer": "^19.2.0",
66
71
  "semantic-release": "^25.0.2",
67
72
  "typescript": "^5.8.3"
68
73
  },
@@ -118,5 +123,8 @@
118
123
  }
119
124
  ]
120
125
  ]
126
+ },
127
+ "dependencies": {
128
+ "nitro-modules": "^0.1.1"
121
129
  }
122
- }
130
+ }
@@ -0,0 +1,8 @@
1
+ import { requireNativeComponent } from 'react-native'
2
+
3
+ export type NitroRecyclerViewProps = {
4
+ itemCount: number
5
+ }
6
+
7
+ export const NitroRecyclerView =
8
+ requireNativeComponent<NitroRecyclerViewProps>('NitroRecyclerView')
@@ -0,0 +1,38 @@
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[] = []