react-native-nitro-list 0.0.1 → 0.1.2
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.
- package/README.md +250 -16
- package/android/build.gradle +5 -4
- package/android/src/main/java/com/nitrolist/HybridNitroRecyclerView.kt +26 -0
- package/android/src/main/java/com/nitrolist/HybridNitroRecyclerViewManager.kt +29 -0
- package/android/src/main/java/com/nitrolist/NitroListPackage.kt +13 -24
- package/android/src/main/java/com/nitrolist/NitroRecyclerAdapter.kt +32 -0
- package/android/src/main/java/com/nitrolist/NitroRecyclerViewHolder.kt +8 -0
- package/ios/HybridNitroList.swift +28 -15
- package/lib/commonjs/NitroList.js +9 -0
- package/lib/commonjs/NitroList.js.map +1 -0
- package/lib/commonjs/ReusableView.js +2 -0
- package/lib/commonjs/ReusableView.js.map +1 -0
- package/lib/commonjs/cell/Cell.js +2 -0
- package/lib/{module/specs/nitro-list.nitro.js.map → commonjs/cell/Cell.js.map} +1 -1
- package/lib/commonjs/cell/CellKeyGenerator.js +21 -0
- package/lib/commonjs/cell/CellKeyGenerator.js.map +1 -0
- package/lib/commonjs/cell/CellRecycler.js +70 -0
- package/lib/commonjs/cell/CellRecycler.js.map +1 -0
- package/lib/commonjs/cell/createCell.js +21 -0
- package/lib/commonjs/cell/createCell.js.map +1 -0
- package/lib/commonjs/cell/index.js +20 -0
- package/lib/commonjs/cell/index.js.map +1 -0
- package/lib/commonjs/debug/useDebugOverlay.js +15 -0
- package/lib/commonjs/debug/useDebugOverlay.js.map +1 -0
- package/lib/commonjs/getVisibleIndices.js +38 -0
- package/lib/commonjs/getVisibleIndices.js.map +1 -0
- package/lib/commonjs/hooks/usePersistentCallback.js +36 -0
- package/lib/commonjs/hooks/usePersistentCallback.js.map +1 -0
- package/lib/commonjs/index.js +7 -5
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/layout/MutableLinearLayout.js +104 -0
- package/lib/commonjs/layout/MutableLinearLayout.js.map +1 -0
- package/lib/commonjs/layout/constants/layoutDefaults.js +19 -0
- package/lib/commonjs/layout/constants/layoutDefaults.js.map +1 -0
- package/lib/commonjs/layout/index.js +2 -0
- package/lib/commonjs/{specs/nitro-list.nitro.js.map → layout/index.js.map} +1 -1
- package/lib/commonjs/measurement/MeasureLayout.js +20 -0
- package/lib/commonjs/measurement/MeasureLayout.js.map +1 -0
- package/lib/commonjs/measurement/useItemMeasurement.js +28 -0
- package/lib/commonjs/measurement/useItemMeasurement.js.map +1 -0
- package/lib/commonjs/native/NitroLayoutEngine.js +9 -0
- package/lib/commonjs/native/NitroLayoutEngine.js.map +1 -0
- package/lib/commonjs/{specs/nitro-list.nitro.js → native/NitroList.types.js} +1 -1
- package/lib/commonjs/native/NitroList.types.js.map +1 -0
- package/lib/commonjs/native/NitroRecyclerView.js +9 -0
- package/lib/commonjs/native/NitroRecyclerView.js.map +1 -0
- package/lib/commonjs/prefetch/PrefetchHelper.js +39 -0
- package/lib/commonjs/prefetch/PrefetchHelper.js.map +1 -0
- package/lib/commonjs/recycler/CellPool.js +46 -0
- package/lib/commonjs/recycler/CellPool.js.map +1 -0
- package/lib/commonjs/recycler/RecyclerList.js +224 -0
- package/lib/commonjs/recycler/RecyclerList.js.map +1 -0
- package/lib/commonjs/specs/nitro-layout-engine.nitro.js +6 -0
- package/lib/commonjs/specs/nitro-layout-engine.nitro.js.map +1 -0
- package/lib/commonjs/types/Axis.js +2 -0
- package/lib/commonjs/types/Axis.js.map +1 -0
- package/lib/commonjs/types/CellKey.js +2 -0
- package/lib/commonjs/types/CellKey.js.map +1 -0
- package/lib/commonjs/types/CellType.js +2 -0
- package/lib/commonjs/types/CellType.js.map +1 -0
- package/lib/commonjs/types/VisibleRange.js +2 -0
- package/lib/commonjs/types/VisibleRange.js.map +1 -0
- package/lib/commonjs/types/VisibleRangeInput.js +6 -0
- package/lib/commonjs/types/VisibleRangeInput.js.map +1 -0
- package/lib/commonjs/types/index.js +13 -0
- package/lib/commonjs/types/index.js.map +1 -0
- package/lib/commonjs/types/layout/LayoutRect.js +2 -0
- package/lib/commonjs/types/layout/LayoutRect.js.map +1 -0
- package/lib/commonjs/types/layout/LinearLayoutInput.js +6 -0
- package/lib/commonjs/types/layout/LinearLayoutInput.js.map +1 -0
- package/lib/commonjs/types/layout/MainAxisPadding.js +26 -0
- package/lib/commonjs/types/layout/MainAxisPadding.js.map +1 -0
- package/lib/commonjs/types/layout/index.js +2 -0
- package/lib/commonjs/types/layout/index.js.map +1 -0
- package/lib/commonjs/types/recycler/RecyclerCellInstance.js +6 -0
- package/lib/commonjs/types/recycler/RecyclerCellInstance.js.map +1 -0
- package/lib/commonjs/types/recycler/RecyclerItemRenderer.js +6 -0
- package/lib/commonjs/types/recycler/RecyclerItemRenderer.js.map +1 -0
- package/lib/commonjs/types/recycler/RecyclerListProps.js +6 -0
- package/lib/commonjs/types/recycler/RecyclerListProps.js.map +1 -0
- package/lib/commonjs/types/recycler/index.js +2 -0
- package/lib/commonjs/types/recycler/index.js.map +1 -0
- package/lib/commonjs/types/scroll/ScrollMetrics.js +6 -0
- package/lib/commonjs/types/scroll/ScrollMetrics.js.map +1 -0
- package/lib/commonjs/types/scroll/index.js +2 -0
- package/lib/commonjs/types/scroll/index.js.map +1 -0
- package/lib/commonjs/utils/arrayEqual.js +15 -0
- package/lib/commonjs/utils/arrayEqual.js.map +1 -0
- package/lib/commonjs/utils/assertNever.js +10 -0
- package/lib/commonjs/utils/assertNever.js.map +1 -0
- package/lib/commonjs/utils/clamp.js +10 -0
- package/lib/commonjs/utils/clamp.js.map +1 -0
- package/lib/commonjs/utils/devAssert.js +12 -0
- package/lib/commonjs/utils/devAssert.js.map +1 -0
- package/lib/commonjs/utils/invariant.js +12 -0
- package/lib/commonjs/utils/invariant.js.map +1 -0
- package/lib/commonjs/utils/isDefined.js +10 -0
- package/lib/commonjs/utils/isDefined.js.map +1 -0
- package/lib/commonjs/utils/isNumber.js +10 -0
- package/lib/commonjs/utils/isNumber.js.map +1 -0
- package/lib/commonjs/utils/noop.js +10 -0
- package/lib/commonjs/utils/noop.js.map +1 -0
- package/lib/commonjs/utils/shallowEqual.js +22 -0
- package/lib/commonjs/utils/shallowEqual.js.map +1 -0
- package/lib/commonjs/utils/throttle.js +17 -0
- package/lib/commonjs/utils/throttle.js.map +1 -0
- package/lib/commonjs/windowing/ScrollMetrics.js +2 -0
- package/lib/commonjs/windowing/ScrollMetrics.js.map +1 -0
- package/lib/commonjs/windowing/computeVisibleItemRange.js +71 -0
- package/lib/commonjs/windowing/computeVisibleItemRange.js.map +1 -0
- package/lib/commonjs/windowing/index.js +20 -0
- package/lib/commonjs/windowing/index.js.map +1 -0
- package/lib/commonjs/windowing/useScrollMetrics.js +39 -0
- package/lib/commonjs/windowing/useScrollMetrics.js.map +1 -0
- package/lib/module/NitroList.js +5 -0
- package/lib/module/NitroList.js.map +1 -0
- package/lib/module/ReusableView.js +2 -0
- package/lib/module/ReusableView.js.map +1 -0
- package/lib/module/cell/Cell.js +2 -0
- package/lib/module/cell/Cell.js.map +1 -0
- package/lib/module/cell/CellKeyGenerator.js +16 -0
- package/lib/module/cell/CellKeyGenerator.js.map +1 -0
- package/lib/module/cell/CellRecycler.js +66 -0
- package/lib/module/cell/CellRecycler.js.map +1 -0
- package/lib/module/cell/createCell.js +17 -0
- package/lib/module/cell/createCell.js.map +1 -0
- package/lib/module/cell/index.js +7 -0
- package/lib/module/cell/index.js.map +1 -0
- package/lib/module/debug/useDebugOverlay.js +11 -0
- package/lib/module/debug/useDebugOverlay.js.map +1 -0
- package/lib/module/getVisibleIndices.js +34 -0
- package/lib/module/getVisibleIndices.js.map +1 -0
- package/lib/module/hooks/usePersistentCallback.js +33 -0
- package/lib/module/hooks/usePersistentCallback.js.map +1 -0
- package/lib/module/index.js +1 -3
- package/lib/module/index.js.map +1 -1
- package/lib/module/layout/MutableLinearLayout.js +100 -0
- package/lib/module/layout/MutableLinearLayout.js.map +1 -0
- package/lib/module/layout/constants/layoutDefaults.js +15 -0
- package/lib/module/layout/constants/layoutDefaults.js.map +1 -0
- package/lib/module/layout/index.js +2 -0
- package/lib/module/layout/index.js.map +1 -0
- package/lib/module/measurement/MeasureLayout.js +16 -0
- package/lib/module/measurement/MeasureLayout.js.map +1 -0
- package/lib/module/measurement/useItemMeasurement.js +24 -0
- package/lib/module/measurement/useItemMeasurement.js.map +1 -0
- package/lib/module/native/NitroLayoutEngine.js +5 -0
- package/lib/module/native/NitroLayoutEngine.js.map +1 -0
- package/lib/module/native/NitroList.types.js +4 -0
- package/lib/module/native/NitroList.types.js.map +1 -0
- package/lib/module/native/NitroRecyclerView.js +5 -0
- package/lib/module/native/NitroRecyclerView.js.map +1 -0
- package/lib/module/prefetch/PrefetchHelper.js +34 -0
- package/lib/module/prefetch/PrefetchHelper.js.map +1 -0
- package/lib/module/recycler/CellPool.js +41 -0
- package/lib/module/recycler/CellPool.js.map +1 -0
- package/lib/module/recycler/RecyclerList.js +221 -0
- package/lib/module/recycler/RecyclerList.js.map +1 -0
- package/lib/module/specs/nitro-layout-engine.nitro.js +4 -0
- package/lib/module/specs/nitro-layout-engine.nitro.js.map +1 -0
- package/lib/module/types/Axis.js +2 -0
- package/lib/module/types/Axis.js.map +1 -0
- package/lib/module/types/CellKey.js +2 -0
- package/lib/module/types/CellKey.js.map +1 -0
- package/lib/module/types/CellType.js +2 -0
- package/lib/module/types/CellType.js.map +1 -0
- package/lib/module/types/VisibleRange.js +2 -0
- package/lib/module/types/VisibleRange.js.map +1 -0
- package/lib/module/types/VisibleRangeInput.js +4 -0
- package/lib/module/types/VisibleRangeInput.js.map +1 -0
- package/lib/module/types/index.js +4 -0
- package/lib/module/types/index.js.map +1 -0
- package/lib/module/types/layout/LayoutRect.js +2 -0
- package/lib/module/types/layout/LayoutRect.js.map +1 -0
- package/lib/module/types/layout/LinearLayoutInput.js +4 -0
- package/lib/module/types/layout/LinearLayoutInput.js.map +1 -0
- package/lib/module/types/layout/MainAxisPadding.js +22 -0
- package/lib/module/types/layout/MainAxisPadding.js.map +1 -0
- package/lib/module/types/layout/index.js +2 -0
- package/lib/module/types/layout/index.js.map +1 -0
- package/lib/module/types/recycler/RecyclerCellInstance.js +4 -0
- package/lib/module/types/recycler/RecyclerCellInstance.js.map +1 -0
- package/lib/module/types/recycler/RecyclerItemRenderer.js +4 -0
- package/lib/module/types/recycler/RecyclerItemRenderer.js.map +1 -0
- package/lib/module/types/recycler/RecyclerListProps.js +4 -0
- package/lib/module/types/recycler/RecyclerListProps.js.map +1 -0
- package/lib/module/types/recycler/index.js +2 -0
- package/lib/module/types/recycler/index.js.map +1 -0
- package/lib/module/types/scroll/ScrollMetrics.js +4 -0
- package/lib/module/types/scroll/ScrollMetrics.js.map +1 -0
- package/lib/module/types/scroll/index.js +2 -0
- package/lib/module/types/scroll/index.js.map +1 -0
- package/lib/module/utils/arrayEqual.js +11 -0
- package/lib/module/utils/arrayEqual.js.map +1 -0
- package/lib/module/utils/assertNever.js +6 -0
- package/lib/module/utils/assertNever.js.map +1 -0
- package/lib/module/utils/clamp.js +6 -0
- package/lib/module/utils/clamp.js.map +1 -0
- package/lib/module/utils/devAssert.js +8 -0
- package/lib/module/utils/devAssert.js.map +1 -0
- package/lib/module/utils/invariant.js +8 -0
- package/lib/module/utils/invariant.js.map +1 -0
- package/lib/module/utils/isDefined.js +6 -0
- package/lib/module/utils/isDefined.js.map +1 -0
- package/lib/module/utils/isNumber.js +6 -0
- package/lib/module/utils/isNumber.js.map +1 -0
- package/lib/module/utils/noop.js +6 -0
- package/lib/module/utils/noop.js.map +1 -0
- package/lib/module/utils/shallowEqual.js +18 -0
- package/lib/module/utils/shallowEqual.js.map +1 -0
- package/lib/module/utils/throttle.js +13 -0
- package/lib/module/utils/throttle.js.map +1 -0
- package/lib/module/windowing/ScrollMetrics.js +2 -0
- package/lib/module/windowing/ScrollMetrics.js.map +1 -0
- package/lib/module/windowing/computeVisibleItemRange.js +67 -0
- package/lib/module/windowing/computeVisibleItemRange.js.map +1 -0
- package/lib/module/windowing/index.js +5 -0
- package/lib/module/windowing/index.js.map +1 -0
- package/lib/module/windowing/useScrollMetrics.js +35 -0
- package/lib/module/windowing/useScrollMetrics.js.map +1 -0
- package/lib/typescript/src/NitroList.d.ts +5 -0
- package/lib/typescript/src/NitroList.d.ts.map +1 -0
- package/lib/typescript/src/ReusableView.d.ts +9 -0
- package/lib/typescript/src/ReusableView.d.ts.map +1 -0
- package/lib/typescript/src/cell/Cell.d.ts +22 -0
- package/lib/typescript/src/cell/Cell.d.ts.map +1 -0
- package/lib/typescript/src/cell/CellKeyGenerator.d.ts +11 -0
- package/lib/typescript/src/cell/CellKeyGenerator.d.ts.map +1 -0
- package/lib/typescript/src/cell/CellRecycler.d.ts +27 -0
- package/lib/typescript/src/cell/CellRecycler.d.ts.map +1 -0
- package/lib/typescript/src/cell/createCell.d.ts +7 -0
- package/lib/typescript/src/cell/createCell.d.ts.map +1 -0
- package/lib/typescript/src/cell/index.d.ts +4 -0
- package/lib/typescript/src/cell/index.d.ts.map +1 -0
- package/lib/typescript/src/debug/useDebugOverlay.d.ts +2 -0
- package/lib/typescript/src/debug/useDebugOverlay.d.ts.map +1 -0
- package/lib/typescript/src/getVisibleIndices.d.ts +8 -0
- package/lib/typescript/src/getVisibleIndices.d.ts.map +1 -0
- package/lib/typescript/src/hooks/usePersistentCallback.d.ts +16 -0
- package/lib/typescript/src/hooks/usePersistentCallback.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +1 -4
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/layout/MutableLinearLayout.d.ts +54 -0
- package/lib/typescript/src/layout/MutableLinearLayout.d.ts.map +1 -0
- package/lib/typescript/src/layout/constants/layoutDefaults.d.ts +13 -0
- package/lib/typescript/src/layout/constants/layoutDefaults.d.ts.map +1 -0
- package/lib/typescript/src/layout/index.d.ts +2 -0
- package/lib/typescript/src/layout/index.d.ts.map +1 -0
- package/lib/typescript/src/measurement/MeasureLayout.d.ts +10 -0
- package/lib/typescript/src/measurement/MeasureLayout.d.ts.map +1 -0
- package/lib/typescript/src/measurement/useItemMeasurement.d.ts +11 -0
- package/lib/typescript/src/measurement/useItemMeasurement.d.ts.map +1 -0
- package/lib/typescript/src/native/NitroLayoutEngine.d.ts +3 -0
- package/lib/typescript/src/native/NitroLayoutEngine.d.ts.map +1 -0
- package/lib/typescript/src/native/NitroList.types.d.ts +9 -0
- package/lib/typescript/src/native/NitroList.types.d.ts.map +1 -0
- package/lib/typescript/src/native/NitroRecyclerView.d.ts +5 -0
- package/lib/typescript/src/native/NitroRecyclerView.d.ts.map +1 -0
- package/lib/typescript/src/prefetch/PrefetchHelper.d.ts +17 -0
- package/lib/typescript/src/prefetch/PrefetchHelper.d.ts.map +1 -0
- package/lib/typescript/src/recycler/CellPool.d.ts +14 -0
- package/lib/typescript/src/recycler/CellPool.d.ts.map +1 -0
- package/lib/typescript/src/recycler/RecyclerList.d.ts +4 -0
- package/lib/typescript/src/recycler/RecyclerList.d.ts.map +1 -0
- package/lib/typescript/src/specs/nitro-layout-engine.nitro.d.ts +14 -0
- package/lib/typescript/src/specs/nitro-layout-engine.nitro.d.ts.map +1 -0
- package/lib/typescript/src/types/Axis.d.ts +11 -0
- package/lib/typescript/src/types/Axis.d.ts.map +1 -0
- package/lib/typescript/src/types/CellKey.d.ts +10 -0
- package/lib/typescript/src/types/CellKey.d.ts.map +1 -0
- package/lib/typescript/src/types/CellType.d.ts +11 -0
- package/lib/typescript/src/types/CellType.d.ts.map +1 -0
- package/lib/typescript/src/types/VisibleRange.d.ts +10 -0
- package/lib/typescript/src/types/VisibleRange.d.ts.map +1 -0
- package/lib/typescript/src/types/VisibleRangeInput.d.ts +35 -0
- package/lib/typescript/src/types/VisibleRangeInput.d.ts.map +1 -0
- package/lib/typescript/src/types/index.d.ts +8 -0
- package/lib/typescript/src/types/index.d.ts.map +1 -0
- package/lib/typescript/src/types/layout/LayoutRect.d.ts +15 -0
- package/lib/typescript/src/types/layout/LayoutRect.d.ts.map +1 -0
- package/lib/typescript/src/types/layout/LinearLayoutInput.d.ts +10 -0
- package/lib/typescript/src/types/layout/LinearLayoutInput.d.ts.map +1 -0
- package/lib/typescript/src/types/layout/MainAxisPadding.d.ts +20 -0
- package/lib/typescript/src/types/layout/MainAxisPadding.d.ts.map +1 -0
- package/lib/typescript/src/types/layout/index.d.ts +4 -0
- package/lib/typescript/src/types/layout/index.d.ts.map +1 -0
- package/lib/typescript/src/types/recycler/RecyclerCellInstance.d.ts +37 -0
- package/lib/typescript/src/types/recycler/RecyclerCellInstance.d.ts.map +1 -0
- package/lib/typescript/src/types/recycler/RecyclerItemRenderer.d.ts +8 -0
- package/lib/typescript/src/types/recycler/RecyclerItemRenderer.d.ts.map +1 -0
- package/lib/typescript/src/types/recycler/RecyclerListProps.d.ts +66 -0
- package/lib/typescript/src/types/recycler/RecyclerListProps.d.ts.map +1 -0
- package/lib/typescript/src/types/recycler/index.d.ts +4 -0
- package/lib/typescript/src/types/recycler/index.d.ts.map +1 -0
- package/lib/typescript/src/types/scroll/ScrollMetrics.d.ts +15 -0
- package/lib/typescript/src/types/scroll/ScrollMetrics.d.ts.map +1 -0
- package/lib/typescript/src/types/scroll/index.d.ts +2 -0
- package/lib/typescript/src/types/scroll/index.d.ts.map +1 -0
- package/lib/typescript/src/utils/arrayEqual.d.ts +2 -0
- package/lib/typescript/src/utils/arrayEqual.d.ts.map +1 -0
- package/lib/typescript/src/utils/assertNever.d.ts +2 -0
- package/lib/typescript/src/utils/assertNever.d.ts.map +1 -0
- package/lib/typescript/src/utils/clamp.d.ts +2 -0
- package/lib/typescript/src/utils/clamp.d.ts.map +1 -0
- package/lib/typescript/src/utils/devAssert.d.ts +2 -0
- package/lib/typescript/src/utils/devAssert.d.ts.map +1 -0
- package/lib/typescript/src/utils/invariant.d.ts +2 -0
- package/lib/typescript/src/utils/invariant.d.ts.map +1 -0
- package/lib/typescript/src/utils/isDefined.d.ts +2 -0
- package/lib/typescript/src/utils/isDefined.d.ts.map +1 -0
- package/lib/typescript/src/utils/isNumber.d.ts +2 -0
- package/lib/typescript/src/utils/isNumber.d.ts.map +1 -0
- package/lib/typescript/src/utils/noop.d.ts +2 -0
- package/lib/typescript/src/utils/noop.d.ts.map +1 -0
- package/lib/typescript/src/utils/shallowEqual.d.ts +2 -0
- package/lib/typescript/src/utils/shallowEqual.d.ts.map +1 -0
- package/lib/typescript/src/utils/throttle.d.ts +2 -0
- package/lib/typescript/src/utils/throttle.d.ts.map +1 -0
- package/lib/typescript/src/windowing/ScrollMetrics.d.ts +11 -0
- package/lib/typescript/src/windowing/ScrollMetrics.d.ts.map +1 -0
- package/lib/typescript/src/windowing/computeVisibleItemRange.d.ts +15 -0
- package/lib/typescript/src/windowing/computeVisibleItemRange.d.ts.map +1 -0
- package/lib/typescript/src/windowing/index.d.ts +4 -0
- package/lib/typescript/src/windowing/index.d.ts.map +1 -0
- package/lib/typescript/src/windowing/useScrollMetrics.d.ts +14 -0
- package/lib/typescript/src/windowing/useScrollMetrics.d.ts.map +1 -0
- package/nitro.json +20 -13
- package/nitrogen/generated/android/NitroList+autolinking.cmake +2 -4
- package/nitrogen/generated/android/NitroListOnLoad.cpp +3 -13
- package/nitrogen/generated/android/c++/JHybridNitroLayoutEngineSpec.cpp +69 -0
- package/nitrogen/generated/android/c++/{JHybridNitroListSpec.hpp → JHybridNitroLayoutEngineSpec.hpp} +12 -13
- package/nitrogen/generated/android/c++/JLayoutRect.hpp +69 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrolist/{HybridNitroListSpec.kt → HybridNitroLayoutEngineSpec.kt} +11 -13
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrolist/LayoutRect.kt +47 -0
- package/nitrogen/generated/ios/NitroList-Swift-Cxx-Bridge.cpp +9 -9
- package/nitrogen/generated/ios/NitroList-Swift-Cxx-Bridge.hpp +50 -13
- package/nitrogen/generated/ios/NitroList-Swift-Cxx-Umbrella.hpp +11 -5
- package/nitrogen/generated/ios/c++/{HybridNitroListSpecSwift.cpp → HybridNitroLayoutEngineSpecSwift.cpp} +2 -2
- package/nitrogen/generated/ios/c++/HybridNitroLayoutEngineSpecSwift.hpp +78 -0
- package/nitrogen/generated/ios/swift/HybridNitroLayoutEngineSpec.swift +56 -0
- package/nitrogen/generated/ios/swift/{HybridNitroListSpec_cxx.swift → HybridNitroLayoutEngineSpec_cxx.swift} +35 -38
- package/nitrogen/generated/ios/swift/LayoutRect.swift +45 -0
- package/nitrogen/generated/shared/c++/{HybridNitroListSpec.cpp → HybridNitroLayoutEngineSpec.cpp} +4 -5
- package/nitrogen/generated/shared/c++/{HybridNitroListSpec.hpp → HybridNitroLayoutEngineSpec.hpp} +15 -14
- package/nitrogen/generated/shared/c++/LayoutRect.hpp +95 -0
- package/package.json +12 -4
- package/src/NitroList.ts +8 -0
- package/src/ReusableView.ts +12 -0
- package/src/cell/Cell.ts +23 -0
- package/src/cell/CellKeyGenerator.ts +17 -0
- package/src/cell/CellRecycler.ts +76 -0
- package/src/cell/createCell.ts +15 -0
- package/src/cell/index.ts +5 -0
- package/src/debug/useDebugOverlay.ts +14 -0
- package/src/getVisibleIndices.ts +55 -0
- package/src/hooks/usePersistentCallback.ts +37 -0
- package/src/index.ts +1 -14
- package/src/layout/MutableLinearLayout.ts +112 -0
- package/src/layout/constants/layoutDefaults.ts +12 -0
- package/src/layout/index.ts +1 -0
- package/src/measurement/MeasureLayout.ts +20 -0
- package/src/measurement/useItemMeasurement.ts +32 -0
- package/src/native/NitroLayoutEngine.ts +7 -0
- package/src/native/NitroList.types.ts +13 -0
- package/src/native/NitroRecyclerView.ts +8 -0
- package/src/prefetch/PrefetchHelper.ts +47 -0
- package/src/recycler/CellPool.ts +47 -0
- package/src/recycler/RecyclerList.tsx +304 -0
- package/src/specs/nitro-layout-engine.nitro.ts +17 -0
- package/src/types/Axis.ts +10 -0
- package/src/types/CellKey.ts +9 -0
- package/src/types/CellType.ts +10 -0
- package/src/types/VisibleRange.ts +9 -0
- package/src/types/VisibleRangeInput.ts +39 -0
- package/src/types/index.ts +15 -0
- package/src/types/layout/LayoutRect.ts +14 -0
- package/src/types/layout/LinearLayoutInput.ts +12 -0
- package/src/types/layout/MainAxisPadding.ts +23 -0
- package/src/types/layout/index.ts +3 -0
- package/src/types/recycler/RecyclerCellInstance.ts +40 -0
- package/src/types/recycler/RecyclerItemRenderer.ts +8 -0
- package/src/types/recycler/RecyclerListProps.ts +74 -0
- package/src/types/recycler/index.ts +3 -0
- package/src/types/scroll/ScrollMetrics.ts +18 -0
- package/src/types/scroll/index.ts +1 -0
- package/src/utils/arrayEqual.ts +13 -0
- package/src/utils/assertNever.ts +3 -0
- package/src/utils/clamp.ts +7 -0
- package/src/utils/devAssert.ts +8 -0
- package/src/utils/invariant.ts +8 -0
- package/src/utils/isDefined.ts +5 -0
- package/src/utils/isNumber.ts +3 -0
- package/src/utils/noop.ts +3 -0
- package/src/utils/shallowEqual.ts +34 -0
- package/src/utils/throttle.ts +13 -0
- package/src/windowing/ScrollMetrics.ts +11 -0
- package/src/windowing/computeVisibleItemRange.ts +78 -0
- package/src/windowing/index.ts +3 -0
- package/src/windowing/useScrollMetrics.ts +56 -0
- package/android/src/main/java/com/nitrolist/HybridNitroList.kt +0 -27
- package/lib/module/specs/nitro-list.nitro.js +0 -4
- package/lib/typescript/src/specs/nitro-list.nitro.d.ts +0 -11
- package/lib/typescript/src/specs/nitro-list.nitro.d.ts.map +0 -1
- package/nitrogen/generated/android/c++/JHybridNitroListSpec.cpp +0 -56
- package/nitrogen/generated/android/c++/views/JHybridNitroListStateUpdater.cpp +0 -56
- package/nitrogen/generated/android/c++/views/JHybridNitroListStateUpdater.hpp +0 -49
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrolist/views/HybridNitroListManager.kt +0 -50
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrolist/views/HybridNitroListStateUpdater.kt +0 -23
- package/nitrogen/generated/ios/NitroListAutolinking.mm +0 -33
- package/nitrogen/generated/ios/NitroListAutolinking.swift +0 -25
- package/nitrogen/generated/ios/c++/HybridNitroListSpecSwift.hpp +0 -74
- package/nitrogen/generated/ios/c++/views/HybridNitroListComponent.mm +0 -96
- package/nitrogen/generated/ios/swift/HybridNitroListSpec.swift +0 -56
- package/nitrogen/generated/shared/c++/views/HybridNitroListComponent.cpp +0 -88
- package/nitrogen/generated/shared/c++/views/HybridNitroListComponent.hpp +0 -107
- package/nitrogen/generated/shared/json/NitroListConfig.json +0 -10
- package/src/specs/nitro-list.nitro.ts +0 -13
package/README.md
CHANGED
|
@@ -1,29 +1,263 @@
|
|
|
1
|
-
#
|
|
1
|
+
# 🚀 NitroList (RecyclerList)
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
**Nitro-powered RecyclerList for React Native New Architecture**
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
[](https://github.com/patrickkabwe/react-native-nitro-list/LICENSE)
|
|
5
|
+
A high-performance, recycler-based list built from the ground up for
|
|
6
|
+
**Fabric + Nitro (JSI)** — no legacy bridge, no hidden overhead.
|
|
8
7
|
|
|
9
|
-
|
|
8
|
+
---
|
|
10
9
|
|
|
11
|
-
|
|
12
|
-
- Node 18.0.0 or higher
|
|
10
|
+
## Preview
|
|
13
11
|
|
|
14
|
-
|
|
15
|
-
> To Support `Nitro Views` you need to install React Native version v0.78.0 or higher.
|
|
12
|
+

|
|
16
13
|
|
|
17
|
-
|
|
14
|
+
**Blazing-fast • Deterministic • Architecture-correct**
|
|
15
|
+
|
|
16
|
+
Built for teams that care about **FPS, memory stability, and correctness**.
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## ✨ What is NitroList?
|
|
21
|
+
|
|
22
|
+
**NitroList** (public component: `RecyclerList`) is a **FlashList-class virtualized list**, designed with a stricter architectural philosophy:
|
|
23
|
+
|
|
24
|
+
- New Architecture only (Fabric)
|
|
25
|
+
- Nitro / JSI friendly
|
|
26
|
+
- True view recycling
|
|
27
|
+
- Explicit layout ownership
|
|
28
|
+
- Predictable memory usage
|
|
29
|
+
|
|
30
|
+
NitroList is **not a beginner abstraction**.
|
|
31
|
+
It is **infrastructure-level UI**, meant for performance-critical React Native apps.
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
## 🧠 Core Design Principles
|
|
36
|
+
|
|
37
|
+
NitroList enforces strict separation of responsibilities:
|
|
38
|
+
|
|
39
|
+
| Responsibility | Owner |
|
|
40
|
+
|----------------|------|
|
|
41
|
+
| Layout truth | MutableLinearLayout (outside React) |
|
|
42
|
+
| Windowing | Pure binary-search windowing |
|
|
43
|
+
| Recycling | Physical cell reuse |
|
|
44
|
+
| Rendering | React (placement only) |
|
|
45
|
+
| Observers | Viewability / Prefetch (read-only) |
|
|
46
|
+
|
|
47
|
+
### Key invariants
|
|
48
|
+
|
|
49
|
+
- React never owns layout state
|
|
50
|
+
- React never decides what exists
|
|
51
|
+
- Layout is a mutable truth outside React
|
|
52
|
+
|
|
53
|
+
This separation is the foundation of stable performance.
|
|
54
|
+
|
|
55
|
+
---
|
|
56
|
+
|
|
57
|
+
## ⚡ Why NitroList over FlatList?
|
|
58
|
+
|
|
59
|
+
### Problems with FlatList
|
|
60
|
+
|
|
61
|
+
- Recreates views instead of recycling
|
|
62
|
+
- Layout is implicit and fragile
|
|
63
|
+
- Memory grows with scroll depth
|
|
64
|
+
- Blank cells under pressure
|
|
65
|
+
- Designed for the legacy bridge
|
|
66
|
+
|
|
67
|
+
### NitroList Advantages
|
|
68
|
+
|
|
69
|
+
- True view recycling
|
|
70
|
+
- Absolute positioning (no reflow)
|
|
71
|
+
- Deterministic windowing
|
|
72
|
+
- Stable memory footprint
|
|
73
|
+
- No legacy bridge usage
|
|
74
|
+
- Architecture designed for scale
|
|
75
|
+
|
|
76
|
+
---
|
|
77
|
+
|
|
78
|
+
## 🆚 NitroList vs FlashList
|
|
79
|
+
|
|
80
|
+
| Feature | FlashList v2 | NitroList |
|
|
81
|
+
|------|-------------|-----------|
|
|
82
|
+
| New Architecture | Yes | Yes |
|
|
83
|
+
| Legacy bridge | No | No |
|
|
84
|
+
| Recycler model | Yes | Yes |
|
|
85
|
+
| Layout ownership | Internal | Explicit & controllable |
|
|
86
|
+
| Nitro / JSI ready | No | Yes |
|
|
87
|
+
| Deterministic memory | Partial | Strict |
|
|
88
|
+
| Architecture clarity | Medium | Very high |
|
|
89
|
+
|
|
90
|
+
### Why NitroList Exists
|
|
91
|
+
|
|
92
|
+
FlashList v2 is excellent — but:
|
|
93
|
+
|
|
94
|
+
- Layout is internal and opaque
|
|
95
|
+
- Hard to integrate with Nitro / JSI native logic
|
|
96
|
+
- Less control over measurement and relayout
|
|
97
|
+
- Harder to reason about invariants
|
|
98
|
+
|
|
99
|
+
NitroList is built for:
|
|
100
|
+
|
|
101
|
+
- Native-heavy apps
|
|
102
|
+
- Nitro / JSI pipelines
|
|
103
|
+
- Custom layout engines
|
|
104
|
+
- Predictable performance at scale
|
|
105
|
+
|
|
106
|
+
---
|
|
107
|
+
|
|
108
|
+
## 🧩 Features
|
|
109
|
+
|
|
110
|
+
### Implemented
|
|
111
|
+
|
|
112
|
+
- Recycler-based rendering
|
|
113
|
+
- Binary-search windowing
|
|
114
|
+
- Adaptive render buffer
|
|
115
|
+
- Deterministic layout engine
|
|
116
|
+
- Viewability tracking
|
|
117
|
+
- Prefetch hooks
|
|
118
|
+
- Full TypeScript safety
|
|
119
|
+
- Unit-tested windowing logic
|
|
120
|
+
|
|
121
|
+
### Partially Implemented
|
|
122
|
+
|
|
123
|
+
- Dynamic measurement pipeline
|
|
124
|
+
- Incremental relayout
|
|
125
|
+
|
|
126
|
+
### Planned
|
|
127
|
+
|
|
128
|
+
- scrollToIndex
|
|
129
|
+
- Sticky headers
|
|
130
|
+
- Masonry layout
|
|
131
|
+
- Native measurement via Nitro
|
|
132
|
+
- Benchmark harness
|
|
133
|
+
|
|
134
|
+
---
|
|
135
|
+
|
|
136
|
+
## 📦 Installation
|
|
18
137
|
|
|
19
138
|
```bash
|
|
20
|
-
npm install react-native-nitro-list
|
|
139
|
+
npm install react-native-nitro-list
|
|
21
140
|
```
|
|
22
141
|
|
|
23
|
-
|
|
142
|
+
> Requires React Native New Architecture
|
|
143
|
+
> NitroList will not run on the legacy bridge.
|
|
144
|
+
|
|
145
|
+
---
|
|
146
|
+
|
|
147
|
+
## 🧑💻 Usage
|
|
148
|
+
|
|
149
|
+
### Basic Usage
|
|
150
|
+
|
|
151
|
+
```tsx
|
|
152
|
+
import { RecyclerList } from 'react-native-nitro-list'
|
|
153
|
+
|
|
154
|
+
<RecyclerList
|
|
155
|
+
containerWidth={width}
|
|
156
|
+
itemCount={10000}
|
|
157
|
+
estimatedItemHeight={80}
|
|
158
|
+
renderItem={(index) => <Row index={index} />}
|
|
159
|
+
/>
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
### Fixed Heights
|
|
163
|
+
|
|
164
|
+
```tsx
|
|
165
|
+
<RecyclerList
|
|
166
|
+
containerWidth={width}
|
|
167
|
+
itemHeights={heights}
|
|
168
|
+
renderItem={renderItem}
|
|
169
|
+
/>
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
---
|
|
173
|
+
|
|
174
|
+
## 👀 Viewability
|
|
175
|
+
|
|
176
|
+
```tsx
|
|
177
|
+
<RecyclerList
|
|
178
|
+
onViewableItemsChanged={({ viewableItems, changed }) => {
|
|
179
|
+
console.log(viewableItems, changed)
|
|
180
|
+
}}
|
|
181
|
+
/>
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
- Percentage-based visibility
|
|
185
|
+
- Deterministic enter / exit events
|
|
186
|
+
- Zero layout mutation
|
|
187
|
+
|
|
188
|
+
---
|
|
189
|
+
|
|
190
|
+
## ⚡ Prefetching
|
|
191
|
+
|
|
192
|
+
```tsx
|
|
193
|
+
<RecyclerList
|
|
194
|
+
onPrefetch={(indices) => {
|
|
195
|
+
preloadData(indices)
|
|
196
|
+
}}
|
|
197
|
+
/>
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
- Runs ahead of the visible window
|
|
201
|
+
- Deduplicated
|
|
202
|
+
- Safe and repeatable
|
|
203
|
+
- Observer-only (never mutates layout)
|
|
204
|
+
|
|
205
|
+
---
|
|
206
|
+
|
|
207
|
+
## 🧪 Testing Philosophy
|
|
208
|
+
|
|
209
|
+
NitroList focuses on pure logic tests:
|
|
210
|
+
|
|
211
|
+
- Windowing correctness
|
|
212
|
+
- Buffer expansion
|
|
213
|
+
- Boundary conditions
|
|
214
|
+
- Off-by-one safety
|
|
215
|
+
|
|
216
|
+
No flaky UI snapshot tests.
|
|
217
|
+
No renderer-dependent assertions.
|
|
218
|
+
|
|
219
|
+
---
|
|
220
|
+
|
|
221
|
+
## 🧠 When Should You Use NitroList?
|
|
222
|
+
|
|
223
|
+
### Use NitroList if:
|
|
224
|
+
|
|
225
|
+
- You are on Fabric / New Architecture
|
|
226
|
+
- You care about memory stability
|
|
227
|
+
- You plan to integrate Nitro / JSI
|
|
228
|
+
- You want explicit control over layout
|
|
229
|
+
- You are building performance-critical screens
|
|
230
|
+
|
|
231
|
+
### Don’t use NitroList if:
|
|
232
|
+
|
|
233
|
+
- You need legacy bridge support
|
|
234
|
+
- You want a beginner-friendly abstraction
|
|
235
|
+
- Your lists are small (less than 500 items)
|
|
236
|
+
- FlatList performance is already sufficient
|
|
237
|
+
|
|
238
|
+
---
|
|
239
|
+
|
|
240
|
+
## 🗺️ Roadmap
|
|
241
|
+
|
|
242
|
+
- v0.2 → measurement pipeline
|
|
243
|
+
- v0.3 → scrollToIndex
|
|
244
|
+
- v0.4 → native measurement (Nitro)
|
|
245
|
+
- v1.0 → production-hardened API
|
|
246
|
+
|
|
247
|
+
---
|
|
248
|
+
|
|
249
|
+
## 🤝 Philosophy
|
|
250
|
+
|
|
251
|
+
NitroList optimizes for:
|
|
252
|
+
|
|
253
|
+
- Correctness over magic
|
|
254
|
+
- Predictability over heuristics
|
|
255
|
+
- Architecture over convenience
|
|
256
|
+
|
|
257
|
+
This library is for engineers who value control.
|
|
24
258
|
|
|
25
|
-
|
|
259
|
+
---
|
|
26
260
|
|
|
27
|
-
##
|
|
261
|
+
## 📄 License
|
|
28
262
|
|
|
29
|
-
|
|
263
|
+
MIT
|
package/android/build.gradle
CHANGED
|
@@ -130,13 +130,14 @@ repositories {
|
|
|
130
130
|
|
|
131
131
|
|
|
132
132
|
dependencies {
|
|
133
|
-
//
|
|
134
|
-
// For > 0.71, this will be replaced by `com.facebook.react:react-android:$version` by react gradle plugin
|
|
135
|
-
//noinspection GradleDynamicVersion
|
|
133
|
+
// React Native
|
|
136
134
|
implementation "com.facebook.react:react-native:+"
|
|
137
135
|
|
|
138
|
-
//
|
|
136
|
+
// Nitro JSI
|
|
139
137
|
implementation project(":react-native-nitro-modules")
|
|
138
|
+
|
|
139
|
+
// ✅ REQUIRED: RecyclerView
|
|
140
|
+
implementation "androidx.recyclerview:recyclerview:1.3.2"
|
|
140
141
|
}
|
|
141
142
|
|
|
142
143
|
if (isNewArchitectureEnabled()) {
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
package com.nitrolist
|
|
2
|
+
|
|
3
|
+
import android.content.Context
|
|
4
|
+
import androidx.recyclerview.widget.LinearLayoutManager
|
|
5
|
+
import androidx.recyclerview.widget.RecyclerView
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Native RecyclerView host.
|
|
9
|
+
* This is a real Android RecyclerView – no Nitro codegen involved.
|
|
10
|
+
*/
|
|
11
|
+
class HybridNitroRecyclerView(context: Context) : RecyclerView(context) {
|
|
12
|
+
|
|
13
|
+
init {
|
|
14
|
+
layoutManager = LinearLayoutManager(context)
|
|
15
|
+
itemAnimator = null
|
|
16
|
+
setHasFixedSize(true)
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
fun setItemCount(count: Int) {
|
|
20
|
+
if (adapter == null) {
|
|
21
|
+
adapter = NitroRecyclerAdapter(count)
|
|
22
|
+
} else {
|
|
23
|
+
(adapter as NitroRecyclerAdapter).updateCount(count)
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
package com.nitrolist
|
|
2
|
+
|
|
3
|
+
import com.facebook.react.uimanager.SimpleViewManager
|
|
4
|
+
import com.facebook.react.uimanager.ThemedReactContext
|
|
5
|
+
import com.facebook.react.uimanager.annotations.ReactProp
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Standard ViewManager.
|
|
9
|
+
* Fabric compatible, handwritten.
|
|
10
|
+
*/
|
|
11
|
+
class HybridNitroRecyclerViewManager :
|
|
12
|
+
SimpleViewManager<HybridNitroRecyclerView>() {
|
|
13
|
+
|
|
14
|
+
override fun getName(): String = "NitroRecyclerView"
|
|
15
|
+
|
|
16
|
+
override fun createViewInstance(
|
|
17
|
+
reactContext: ThemedReactContext
|
|
18
|
+
): HybridNitroRecyclerView {
|
|
19
|
+
return HybridNitroRecyclerView(reactContext)
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
@ReactProp(name = "itemCount")
|
|
23
|
+
fun setItemCount(
|
|
24
|
+
view: HybridNitroRecyclerView,
|
|
25
|
+
count: Int
|
|
26
|
+
) {
|
|
27
|
+
view.setItemCount(count)
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -1,29 +1,18 @@
|
|
|
1
|
-
package com.nitrolist
|
|
1
|
+
package com.nitrolist
|
|
2
2
|
|
|
3
|
-
import com.facebook.react.
|
|
4
|
-
import com.facebook.react.bridge.
|
|
5
|
-
import com.facebook.react.
|
|
6
|
-
import com.facebook.react.
|
|
7
|
-
import com.facebook.react.uimanager.ViewManager;
|
|
8
|
-
import com.margelo.nitro.nitrolist.*;
|
|
9
|
-
import com.margelo.nitro.nitrolist.views.*;
|
|
3
|
+
import com.facebook.react.ReactPackage
|
|
4
|
+
import com.facebook.react.bridge.NativeModule
|
|
5
|
+
import com.facebook.react.bridge.ReactApplicationContext
|
|
6
|
+
import com.facebook.react.uimanager.ViewManager
|
|
10
7
|
|
|
8
|
+
class NitroListPackage : ReactPackage {
|
|
11
9
|
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
override fun createNativeModules(
|
|
11
|
+
reactContext: ReactApplicationContext
|
|
12
|
+
): List<NativeModule> = emptyList()
|
|
14
13
|
|
|
15
|
-
override fun
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
viewManagers.add(HybridNitroListManager())
|
|
20
|
-
return viewManagers
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
companion object {
|
|
24
|
-
init {
|
|
25
|
-
NitroListOnLoad.initializeNative()
|
|
26
|
-
}
|
|
27
|
-
}
|
|
14
|
+
override fun createViewManagers(
|
|
15
|
+
reactContext: ReactApplicationContext
|
|
16
|
+
): List<ViewManager<*, *>> =
|
|
17
|
+
listOf(HybridNitroRecyclerViewManager())
|
|
28
18
|
}
|
|
29
|
-
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
package com.nitrolist
|
|
2
|
+
|
|
3
|
+
import android.view.View
|
|
4
|
+
import android.view.ViewGroup
|
|
5
|
+
import androidx.recyclerview.widget.RecyclerView
|
|
6
|
+
|
|
7
|
+
class NitroRecyclerAdapter(
|
|
8
|
+
private var itemCountInternal: Int
|
|
9
|
+
) : RecyclerView.Adapter<NitroRecyclerViewHolder>() {
|
|
10
|
+
|
|
11
|
+
override fun onCreateViewHolder(
|
|
12
|
+
parent: ViewGroup,
|
|
13
|
+
viewType: Int
|
|
14
|
+
): NitroRecyclerViewHolder {
|
|
15
|
+
val view = View(parent.context)
|
|
16
|
+
return NitroRecyclerViewHolder(view)
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
override fun onBindViewHolder(
|
|
20
|
+
holder: NitroRecyclerViewHolder,
|
|
21
|
+
position: Int
|
|
22
|
+
) {
|
|
23
|
+
// JS/Fabric will manage children later
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
override fun getItemCount(): Int = itemCountInternal
|
|
27
|
+
|
|
28
|
+
fun updateCount(newCount: Int) {
|
|
29
|
+
itemCountInternal = newCount
|
|
30
|
+
notifyDataSetChanged()
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -1,21 +1,34 @@
|
|
|
1
|
-
//
|
|
2
|
-
// HybridNitroList.swift
|
|
3
|
-
// Pods
|
|
4
|
-
//
|
|
5
|
-
// Created by Shiv Shankar Tiwari on 25/12/2025.
|
|
6
|
-
//
|
|
7
|
-
|
|
8
1
|
import Foundation
|
|
9
|
-
import
|
|
2
|
+
import NitroModules
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Native layout engine for RecyclerList.
|
|
6
|
+
* Pure, deterministic, synchronous computation.
|
|
7
|
+
*/
|
|
8
|
+
final class HybridNitroLayoutEngine: HybridNitroLayoutEngineSpec {
|
|
9
|
+
|
|
10
|
+
func computeLayout(
|
|
11
|
+
containerWidth: Double,
|
|
12
|
+
itemHeights: [Double]
|
|
13
|
+
) -> [LayoutRect] {
|
|
10
14
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
var view: UIView = UIView()
|
|
15
|
+
var layouts: [LayoutRect] = []
|
|
16
|
+
layouts.reserveCapacity(itemHeights.count)
|
|
14
17
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
18
|
+
var currentY: Double = 0
|
|
19
|
+
|
|
20
|
+
for height in itemHeights {
|
|
21
|
+
layouts.append(
|
|
22
|
+
LayoutRect(
|
|
23
|
+
x: 0,
|
|
24
|
+
y: currentY,
|
|
25
|
+
width: containerWidth,
|
|
26
|
+
height: height
|
|
27
|
+
)
|
|
28
|
+
)
|
|
29
|
+
currentY += height
|
|
19
30
|
}
|
|
31
|
+
|
|
32
|
+
return layouts
|
|
20
33
|
}
|
|
21
34
|
}
|
|
@@ -0,0 +1,9 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../src","sources":["ReusableView.ts"],"mappings":"","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sourceRoot":"../../../src","sources":["
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../src","sources":["cell/Cell.ts"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.CellKeyGenerator = void 0;
|
|
7
|
+
/**
|
|
8
|
+
* Monotonic key generator for physical cell instances.
|
|
9
|
+
* Guarantees stable keys across the lifetime of the list.
|
|
10
|
+
*/
|
|
11
|
+
class CellKeyGenerator {
|
|
12
|
+
nextId = 0;
|
|
13
|
+
next() {
|
|
14
|
+
return this.nextId++;
|
|
15
|
+
}
|
|
16
|
+
reset() {
|
|
17
|
+
this.nextId = 0;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
exports.CellKeyGenerator = CellKeyGenerator;
|
|
21
|
+
//# sourceMappingURL=CellKeyGenerator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["CellKeyGenerator","nextId","next","reset","exports"],"sourceRoot":"../../../src","sources":["cell/CellKeyGenerator.ts"],"mappings":";;;;;;AAEA;AACA;AACA;AACA;AACO,MAAMA,gBAAgB,CAAC;EACpBC,MAAM,GAAG,CAAC;EAElBC,IAAIA,CAAA,EAAY;IACd,OAAO,IAAI,CAACD,MAAM,EAAE;EACtB;EAEAE,KAAKA,CAAA,EAAS;IACZ,IAAI,CAACF,MAAM,GAAG,CAAC;EACjB;AACF;AAACG,OAAA,CAAAJ,gBAAA,GAAAA,gBAAA","ignoreList":[]}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.CellRecycler = void 0;
|
|
7
|
+
var _createCell = require("./createCell");
|
|
8
|
+
/**
|
|
9
|
+
* Manages physical cell reuse.
|
|
10
|
+
* Imperative and stateful by design.
|
|
11
|
+
* This is NOT React code.
|
|
12
|
+
*/
|
|
13
|
+
class CellRecycler {
|
|
14
|
+
/**
|
|
15
|
+
* Active cells mapped by logical index.
|
|
16
|
+
*/
|
|
17
|
+
indexToCell = new Map();
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Pool of detached reusable cells.
|
|
21
|
+
*/
|
|
22
|
+
recycledCells = [];
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Reconcile a contiguous visible index range
|
|
26
|
+
* into a stable list of physical cells.
|
|
27
|
+
*
|
|
28
|
+
* HOT PATH:
|
|
29
|
+
* - No index arrays
|
|
30
|
+
* - Minimal allocations
|
|
31
|
+
* - Deterministic
|
|
32
|
+
*/
|
|
33
|
+
reconcileRange(startIndex, endIndex, resolveCellType) {
|
|
34
|
+
const nextActive = [];
|
|
35
|
+
|
|
36
|
+
// Track which current indices are no longer visible
|
|
37
|
+
const unusedIndices = new Set(this.indexToCell.keys());
|
|
38
|
+
for (let index = startIndex; index <= endIndex; index++) {
|
|
39
|
+
unusedIndices.delete(index);
|
|
40
|
+
let cell = this.indexToCell.get(index);
|
|
41
|
+
if (cell) {
|
|
42
|
+
// Existing assignment — reuse
|
|
43
|
+
nextActive.push(cell);
|
|
44
|
+
continue;
|
|
45
|
+
}
|
|
46
|
+
const type = resolveCellType(index);
|
|
47
|
+
|
|
48
|
+
// Try to reuse a recycled cell of same type
|
|
49
|
+
const recycledIdx = this.recycledCells.findIndex(c => c.type === type);
|
|
50
|
+
if (recycledIdx !== -1) {
|
|
51
|
+
cell = this.recycledCells.splice(recycledIdx, 1)[0];
|
|
52
|
+
} else {
|
|
53
|
+
cell = (0, _createCell.createCell)(type);
|
|
54
|
+
}
|
|
55
|
+
cell.index = index;
|
|
56
|
+
this.indexToCell.set(index, cell);
|
|
57
|
+
nextActive.push(cell);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
// Recycle cells that left the visible window
|
|
61
|
+
for (const index of unusedIndices) {
|
|
62
|
+
const cell = this.indexToCell.get(index);
|
|
63
|
+
this.indexToCell.delete(index);
|
|
64
|
+
this.recycledCells.push(cell);
|
|
65
|
+
}
|
|
66
|
+
return nextActive;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
exports.CellRecycler = CellRecycler;
|
|
70
|
+
//# sourceMappingURL=CellRecycler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_createCell","require","CellRecycler","indexToCell","Map","recycledCells","reconcileRange","startIndex","endIndex","resolveCellType","nextActive","unusedIndices","Set","keys","index","delete","cell","get","push","type","recycledIdx","findIndex","c","splice","createCell","set","exports"],"sourceRoot":"../../../src","sources":["cell/CellRecycler.ts"],"mappings":";;;;;;AACA,IAAAA,WAAA,GAAAC,OAAA;AAEA;AACA;AACA;AACA;AACA;AACO,MAAMC,YAAY,CAAC;EACxB;AACF;AACA;EACmBC,WAAW,GAAG,IAAIC,GAAG,CAAe,CAAC;;EAEtD;AACF;AACA;EACmBC,aAAa,GAAW,EAAE;;EAE3C;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACEC,cAAcA,CACZC,UAAkB,EAClBC,QAAgB,EAChBC,eAA0C,EACzB;IACjB,MAAMC,UAAkB,GAAG,EAAE;;IAE7B;IACA,MAAMC,aAAa,GAAG,IAAIC,GAAG,CAAC,IAAI,CAACT,WAAW,CAACU,IAAI,CAAC,CAAC,CAAC;IAEtD,KAAK,IAAIC,KAAK,GAAGP,UAAU,EAAEO,KAAK,IAAIN,QAAQ,EAAEM,KAAK,EAAE,EAAE;MACvDH,aAAa,CAACI,MAAM,CAACD,KAAK,CAAC;MAE3B,IAAIE,IAAI,GAAG,IAAI,CAACb,WAAW,CAACc,GAAG,CAACH,KAAK,CAAC;MACtC,IAAIE,IAAI,EAAE;QACR;QACAN,UAAU,CAACQ,IAAI,CAACF,IAAI,CAAC;QACrB;MACF;MAEA,MAAMG,IAAI,GAAGV,eAAe,CAACK,KAAK,CAAC;;MAEnC;MACA,MAAMM,WAAW,GAAG,IAAI,CAACf,aAAa,CAACgB,SAAS,CAC9CC,CAAC,IAAIA,CAAC,CAACH,IAAI,KAAKA,IAClB,CAAC;MAED,IAAIC,WAAW,KAAK,CAAC,CAAC,EAAE;QACtBJ,IAAI,GAAG,IAAI,CAACX,aAAa,CAACkB,MAAM,CAACH,WAAW,EAAE,CAAC,CAAC,CAAC,CAAC,CAAE;MACtD,CAAC,MAAM;QACLJ,IAAI,GAAG,IAAAQ,sBAAU,EAACL,IAAI,CAAC;MACzB;MAEAH,IAAI,CAACF,KAAK,GAAGA,KAAK;MAClB,IAAI,CAACX,WAAW,CAACsB,GAAG,CAACX,KAAK,EAAEE,IAAI,CAAC;MACjCN,UAAU,CAACQ,IAAI,CAACF,IAAI,CAAC;IACvB;;IAEA;IACA,KAAK,MAAMF,KAAK,IAAIH,aAAa,EAAE;MACjC,MAAMK,IAAI,GAAG,IAAI,CAACb,WAAW,CAACc,GAAG,CAACH,KAAK,CAAE;MACzC,IAAI,CAACX,WAAW,CAACY,MAAM,CAACD,KAAK,CAAC;MAC9B,IAAI,CAACT,aAAa,CAACa,IAAI,CAACF,IAAI,CAAC;IAC/B;IAEA,OAAON,UAAU;EACnB;AACF;AAACgB,OAAA,CAAAxB,YAAA,GAAAA,YAAA","ignoreList":[]}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.createCell = createCell;
|
|
7
|
+
let nextCellId = 0;
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Creates a new physical cell with a stable identity.
|
|
11
|
+
* The key is generated ONCE and never changes.
|
|
12
|
+
*/
|
|
13
|
+
function createCell(type) {
|
|
14
|
+
return {
|
|
15
|
+
key: `cell-${nextCellId++}`,
|
|
16
|
+
// stable physical identity
|
|
17
|
+
type,
|
|
18
|
+
index: -1 // assigned by recycler
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=createCell.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["nextCellId","createCell","type","key","index"],"sourceRoot":"../../../src","sources":["cell/createCell.ts"],"mappings":";;;;;;AAEA,IAAIA,UAAU,GAAG,CAAC;;AAElB;AACA;AACA;AACA;AACO,SAASC,UAAUA,CAACC,IAAY,EAAQ;EAC7C,OAAO;IACLC,GAAG,EAAE,QAAQH,UAAU,EAAE,EAAE;IAAE;IAC7BE,IAAI;IACJE,KAAK,EAAE,CAAC,CAAC,CAAmB;EAC9B,CAAC;AACH","ignoreList":[]}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "CellRecycler", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _CellRecycler.CellRecycler;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
Object.defineProperty(exports, "createCell", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () {
|
|
15
|
+
return _createCell.createCell;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
var _CellRecycler = require("./CellRecycler");
|
|
19
|
+
var _createCell = require("./createCell");
|
|
20
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_CellRecycler","require","_createCell"],"sourceRoot":"../../../src","sources":["cell/index.ts"],"mappings":";;;;;;;;;;;;;;;;;AAGA,IAAAA,aAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA","ignoreList":[]}
|