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.
- package/README.md +16 -44
- package/ios/HybridNitroList.swift +12 -14
- package/lib/commonjs/cell/CellKeyGenerator.js +21 -0
- package/lib/commonjs/cell/CellKeyGenerator.js.map +1 -0
- package/lib/commonjs/cell/CellRecycler.js +48 -40
- package/lib/commonjs/cell/CellRecycler.js.map +1 -1
- 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/getVisibleIndices.js.map +1 -1
- package/lib/commonjs/hooks/usePersistentCallback.js +36 -0
- package/lib/commonjs/hooks/usePersistentCallback.js.map +1 -0
- package/lib/commonjs/index.js +31 -3
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/layout/MutableLinearLayout.js +78 -39
- package/lib/commonjs/layout/MutableLinearLayout.js.map +1 -1
- 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 +0 -18
- package/lib/commonjs/layout/index.js.map +1 -1
- package/lib/commonjs/native/NitroListView.js +20 -0
- package/lib/commonjs/native/NitroListView.js.map +1 -0
- package/lib/commonjs/recycler/CellPool.js +33 -0
- package/lib/commonjs/recycler/CellPool.js.map +1 -0
- package/lib/commonjs/recycler/NitroList.js +223 -0
- package/lib/commonjs/recycler/NitroList.js.map +1 -0
- package/lib/commonjs/scroll/useScrollVelocity.js +20 -0
- package/lib/commonjs/scroll/useScrollVelocity.js.map +1 -0
- package/lib/commonjs/{native/NitroList.types.js → specs/NitroList.nitro.js} +1 -1
- package/lib/commonjs/{layout/LayoutProvider.js.map → specs/NitroList.nitro.js.map} +1 -1
- package/lib/commonjs/types/Axis.js +2 -0
- package/lib/{module/layout/LayoutProvider.js.map → commonjs/types/Axis.js.map} +1 -1
- package/lib/commonjs/types/CellKey.js +2 -0
- package/lib/commonjs/{layout/LayoutRectangle.js.map → types/CellKey.js.map} +1 -1
- package/lib/commonjs/types/CellType.js +27 -0
- package/lib/commonjs/types/CellType.js.map +1 -0
- package/lib/commonjs/types/VisibleRange.js +2 -0
- package/lib/commonjs/{native/NitroList.types.js.map → types/VisibleRange.js.map} +1 -1
- package/lib/commonjs/{RecyclerList.types.js → types/VisibleRangeInput.js} +1 -1
- 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/{specs/nitro-layout-engine.nitro.js → types/layout/LinearLayoutInput.js} +1 -1
- 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/CellPool.js +42 -0
- package/lib/commonjs/types/recycler/CellPool.js.map +1 -0
- package/lib/commonjs/{layout/LayoutProvider.js → types/recycler/NitroListProps.js} +1 -1
- package/lib/commonjs/types/recycler/NitroListProps.js.map +1 -0
- package/lib/commonjs/types/recycler/RecyclerCell.js +6 -0
- package/lib/commonjs/types/recycler/RecyclerCell.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/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/windowing/computeVisibleItemRange.js +61 -0
- package/lib/commonjs/windowing/computeVisibleItemRange.js.map +1 -0
- package/lib/commonjs/windowing/index.js +3 -3
- package/lib/commonjs/windowing/index.js.map +1 -1
- package/lib/module/cell/CellKeyGenerator.js +16 -0
- package/lib/module/cell/CellKeyGenerator.js.map +1 -0
- package/lib/module/cell/CellRecycler.js +48 -39
- package/lib/module/cell/CellRecycler.js.map +1 -1
- 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/getVisibleIndices.js.map +1 -1
- package/lib/module/hooks/usePersistentCallback.js +33 -0
- package/lib/module/hooks/usePersistentCallback.js.map +1 -0
- package/lib/module/index.js +5 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/layout/MutableLinearLayout.js +78 -38
- package/lib/module/layout/MutableLinearLayout.js.map +1 -1
- 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 +0 -3
- package/lib/module/layout/index.js.map +1 -1
- package/lib/module/native/NitroListView.js +17 -0
- package/lib/module/native/NitroListView.js.map +1 -0
- package/lib/module/recycler/CellPool.js +28 -0
- package/lib/module/recycler/CellPool.js.map +1 -0
- package/lib/module/recycler/NitroList.js +220 -0
- package/lib/module/recycler/NitroList.js.map +1 -0
- package/lib/module/scroll/useScrollVelocity.js +16 -0
- package/lib/module/scroll/useScrollVelocity.js.map +1 -0
- package/lib/module/specs/NitroList.nitro.js +4 -0
- package/lib/module/specs/NitroList.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 +22 -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/CellPool.js +37 -0
- package/lib/module/types/recycler/CellPool.js.map +1 -0
- package/lib/module/types/recycler/NitroListProps.js +4 -0
- package/lib/module/types/recycler/NitroListProps.js.map +1 -0
- package/lib/module/types/recycler/RecyclerCell.js +4 -0
- package/lib/module/types/recycler/RecyclerCell.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/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/windowing/computeVisibleItemRange.js +57 -0
- package/lib/module/windowing/computeVisibleItemRange.js.map +1 -0
- package/lib/module/windowing/index.js +1 -1
- package/lib/module/windowing/index.js.map +1 -1
- package/lib/typescript/src/cell/Cell.d.ts +13 -4
- package/lib/typescript/src/cell/Cell.d.ts.map +1 -1
- 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 +19 -11
- package/lib/typescript/src/cell/CellRecycler.d.ts.map +1 -1
- 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/getVisibleIndices.d.ts +2 -2
- package/lib/typescript/src/getVisibleIndices.d.ts.map +1 -1
- 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 +3 -2
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/layout/MutableLinearLayout.d.ts +45 -13
- package/lib/typescript/src/layout/MutableLinearLayout.d.ts.map +1 -1
- 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 +1 -4
- package/lib/typescript/src/layout/index.d.ts.map +1 -1
- package/lib/typescript/src/native/NitroListView.d.ts +20 -0
- package/lib/typescript/src/native/NitroListView.d.ts.map +1 -0
- package/lib/typescript/src/recycler/CellPool.d.ts +11 -0
- package/lib/typescript/src/recycler/CellPool.d.ts.map +1 -0
- package/lib/typescript/src/recycler/NitroList.d.ts +4 -0
- package/lib/typescript/src/recycler/NitroList.d.ts.map +1 -0
- package/lib/typescript/src/scroll/useScrollVelocity.d.ts +2 -0
- package/lib/typescript/src/scroll/useScrollVelocity.d.ts.map +1 -0
- package/lib/typescript/src/specs/NitroList.nitro.d.ts +26 -0
- package/lib/typescript/src/specs/NitroList.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 +2 -0
- package/lib/typescript/src/types/CellKey.d.ts.map +1 -0
- package/lib/typescript/src/types/CellType.d.ts +22 -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/CellPool.d.ts +16 -0
- package/lib/typescript/src/types/recycler/CellPool.d.ts.map +1 -0
- package/lib/typescript/src/types/recycler/NitroListProps.d.ts +66 -0
- package/lib/typescript/src/types/recycler/NitroListProps.d.ts.map +1 -0
- package/lib/typescript/src/types/recycler/RecyclerCell.d.ts +12 -0
- package/lib/typescript/src/types/recycler/RecyclerCell.d.ts.map +1 -0
- package/lib/typescript/src/types/recycler/RecyclerItemRenderer.d.ts +12 -0
- package/lib/typescript/src/types/recycler/RecyclerItemRenderer.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/windowing/computeVisibleItemRange.d.ts +19 -0
- package/lib/typescript/src/windowing/computeVisibleItemRange.d.ts.map +1 -0
- package/lib/typescript/src/windowing/index.d.ts +1 -1
- package/lib/typescript/src/windowing/index.d.ts.map +1 -1
- package/nitro.json +5 -5
- package/nitrogen/generated/android/NitroList+autolinking.cmake +2 -2
- package/nitrogen/generated/android/NitroListOnLoad.cpp +2 -2
- package/nitrogen/generated/android/c++/{JHybridNitroLayoutEngineSpec.cpp → JHybridNitroListSpec.cpp} +15 -15
- package/nitrogen/generated/android/c++/{JHybridNitroLayoutEngineSpec.hpp → JHybridNitroListSpec.hpp} +11 -11
- package/nitrogen/generated/android/c++/{JLayoutRectangle.hpp → JItemLayout.hpp} +10 -10
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrolist/{HybridNitroLayoutEngineSpec.kt → HybridNitroListSpec.kt} +7 -7
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrolist/{LayoutRectangle.kt → ItemLayout.kt} +5 -5
- package/nitrogen/generated/ios/NitroList-Swift-Cxx-Bridge.cpp +9 -9
- package/nitrogen/generated/ios/NitroList-Swift-Cxx-Bridge.hpp +27 -27
- package/nitrogen/generated/ios/NitroList-Swift-Cxx-Umbrella.hpp +8 -8
- package/nitrogen/generated/ios/c++/{HybridNitroLayoutEngineSpecSwift.cpp → HybridNitroListSpecSwift.cpp} +2 -2
- package/nitrogen/generated/ios/c++/{HybridNitroLayoutEngineSpecSwift.hpp → HybridNitroListSpecSwift.hpp} +16 -16
- package/nitrogen/generated/ios/swift/HybridNitroListSpec.swift +56 -0
- package/nitrogen/generated/ios/swift/{HybridNitroLayoutEngineSpec_cxx.swift → HybridNitroListSpec_cxx.swift} +23 -23
- package/nitrogen/generated/ios/swift/{LayoutRectangle.swift → ItemLayout.swift} +5 -5
- package/nitrogen/generated/shared/c++/{HybridNitroLayoutEngineSpec.cpp → HybridNitroListSpec.cpp} +4 -4
- package/nitrogen/generated/shared/c++/{HybridNitroLayoutEngineSpec.hpp → HybridNitroListSpec.hpp} +13 -13
- package/nitrogen/generated/shared/c++/{LayoutRectangle.hpp → ItemLayout.hpp} +11 -11
- package/package.json +5 -5
- package/src/cell/Cell.ts +13 -4
- package/src/cell/CellKeyGenerator.ts +17 -0
- package/src/cell/CellRecycler.ts +53 -43
- package/src/cell/createCell.ts +15 -0
- package/src/cell/index.ts +5 -0
- package/src/getVisibleIndices.ts +4 -2
- package/src/hooks/usePersistentCallback.ts +37 -0
- package/src/index.ts +7 -2
- package/src/layout/MutableLinearLayout.ts +91 -58
- package/src/layout/constants/layoutDefaults.ts +12 -0
- package/src/layout/index.ts +1 -4
- package/src/native/NitroListView.ts +22 -0
- package/src/recycler/CellPool.ts +33 -0
- package/src/recycler/NitroList.tsx +317 -0
- package/src/scroll/useScrollVelocity.ts +16 -0
- package/src/specs/NitroList.nitro.ts +29 -0
- package/src/types/Axis.ts +10 -0
- package/src/types/CellKey.ts +2 -0
- package/src/types/CellType.ts +9 -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/CellPool.ts +45 -0
- package/src/types/recycler/NitroListProps.ts +74 -0
- package/src/types/recycler/RecyclerCell.ts +12 -0
- package/src/types/recycler/RecyclerItemRenderer.ts +12 -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/windowing/computeVisibleItemRange.ts +82 -0
- package/src/windowing/index.ts +1 -1
- package/lib/commonjs/NitroList.js +0 -9
- package/lib/commonjs/NitroList.js.map +0 -1
- package/lib/commonjs/RecyclerList.internal.js +0 -25
- package/lib/commonjs/RecyclerList.internal.js.map +0 -1
- package/lib/commonjs/RecyclerList.js +0 -171
- package/lib/commonjs/RecyclerList.js.map +0 -1
- package/lib/commonjs/RecyclerList.types.js.map +0 -1
- package/lib/commonjs/cell/StableKey.js +0 -10
- package/lib/commonjs/cell/StableKey.js.map +0 -1
- package/lib/commonjs/hooks/useCellRenderer.js +0 -62
- package/lib/commonjs/hooks/useCellRenderer.js.map +0 -1
- package/lib/commonjs/hooks/useStableCallback.js +0 -13
- package/lib/commonjs/hooks/useStableCallback.js.map +0 -1
- package/lib/commonjs/layout/EstimatedLayoutProvider.js +0 -30
- package/lib/commonjs/layout/EstimatedLayoutProvider.js.map +0 -1
- package/lib/commonjs/layout/LayoutEngine.js +0 -21
- package/lib/commonjs/layout/LayoutEngine.js.map +0 -1
- package/lib/commonjs/layout/LayoutRectangle.js +0 -2
- package/lib/commonjs/native/NitroLayoutEngine.js +0 -9
- package/lib/commonjs/native/NitroLayoutEngine.js.map +0 -1
- package/lib/commonjs/native/NitroRecyclerView.js +0 -9
- package/lib/commonjs/native/NitroRecyclerView.js.map +0 -1
- package/lib/commonjs/specs/nitro-layout-engine.nitro.js.map +0 -1
- package/lib/commonjs/viewability/ViewabilityHelper.js +0 -121
- package/lib/commonjs/viewability/ViewabilityHelper.js.map +0 -1
- package/lib/commonjs/windowing/findVisibleIndexRange.js +0 -48
- package/lib/commonjs/windowing/findVisibleIndexRange.js.map +0 -1
- package/lib/module/NitroList.js +0 -5
- package/lib/module/NitroList.js.map +0 -1
- package/lib/module/RecyclerList.internal.js +0 -22
- package/lib/module/RecyclerList.internal.js.map +0 -1
- package/lib/module/RecyclerList.js +0 -166
- package/lib/module/RecyclerList.js.map +0 -1
- package/lib/module/RecyclerList.types.js +0 -4
- package/lib/module/RecyclerList.types.js.map +0 -1
- package/lib/module/cell/StableKey.js +0 -6
- package/lib/module/cell/StableKey.js.map +0 -1
- package/lib/module/hooks/useCellRenderer.js +0 -58
- package/lib/module/hooks/useCellRenderer.js.map +0 -1
- package/lib/module/hooks/useStableCallback.js +0 -9
- package/lib/module/hooks/useStableCallback.js.map +0 -1
- package/lib/module/layout/EstimatedLayoutProvider.js +0 -25
- package/lib/module/layout/EstimatedLayoutProvider.js.map +0 -1
- package/lib/module/layout/LayoutEngine.js +0 -17
- package/lib/module/layout/LayoutEngine.js.map +0 -1
- package/lib/module/layout/LayoutProvider.js +0 -4
- package/lib/module/layout/LayoutRectangle.js +0 -2
- package/lib/module/layout/LayoutRectangle.js.map +0 -1
- package/lib/module/native/NitroLayoutEngine.js +0 -5
- package/lib/module/native/NitroLayoutEngine.js.map +0 -1
- package/lib/module/native/NitroList.types.js +0 -4
- package/lib/module/native/NitroList.types.js.map +0 -1
- package/lib/module/native/NitroRecyclerView.js +0 -5
- package/lib/module/native/NitroRecyclerView.js.map +0 -1
- package/lib/module/specs/nitro-layout-engine.nitro.js +0 -4
- package/lib/module/specs/nitro-layout-engine.nitro.js.map +0 -1
- package/lib/module/viewability/ViewabilityHelper.js +0 -116
- package/lib/module/viewability/ViewabilityHelper.js.map +0 -1
- package/lib/module/windowing/findVisibleIndexRange.js +0 -44
- package/lib/module/windowing/findVisibleIndexRange.js.map +0 -1
- package/lib/typescript/src/NitroList.d.ts +0 -5
- package/lib/typescript/src/NitroList.d.ts.map +0 -1
- package/lib/typescript/src/RecyclerList.d.ts +0 -26
- package/lib/typescript/src/RecyclerList.d.ts.map +0 -1
- package/lib/typescript/src/RecyclerList.internal.d.ts +0 -9
- package/lib/typescript/src/RecyclerList.internal.d.ts.map +0 -1
- package/lib/typescript/src/RecyclerList.types.d.ts +0 -18
- package/lib/typescript/src/RecyclerList.types.d.ts.map +0 -1
- package/lib/typescript/src/__tests__/windowing/findVisibleIndexRange.test.d.ts +0 -2
- package/lib/typescript/src/__tests__/windowing/findVisibleIndexRange.test.d.ts.map +0 -1
- package/lib/typescript/src/cell/StableKey.d.ts +0 -2
- package/lib/typescript/src/cell/StableKey.d.ts.map +0 -1
- package/lib/typescript/src/hooks/useCellRenderer.d.ts +0 -19
- package/lib/typescript/src/hooks/useCellRenderer.d.ts.map +0 -1
- package/lib/typescript/src/hooks/useStableCallback.d.ts +0 -2
- package/lib/typescript/src/hooks/useStableCallback.d.ts.map +0 -1
- package/lib/typescript/src/layout/EstimatedLayoutProvider.d.ts +0 -15
- package/lib/typescript/src/layout/EstimatedLayoutProvider.d.ts.map +0 -1
- package/lib/typescript/src/layout/LayoutEngine.d.ts +0 -10
- package/lib/typescript/src/layout/LayoutEngine.d.ts.map +0 -1
- package/lib/typescript/src/layout/LayoutProvider.d.ts +0 -16
- package/lib/typescript/src/layout/LayoutProvider.d.ts.map +0 -1
- package/lib/typescript/src/layout/LayoutRectangle.d.ts +0 -11
- package/lib/typescript/src/layout/LayoutRectangle.d.ts.map +0 -1
- package/lib/typescript/src/native/NitroLayoutEngine.d.ts +0 -3
- package/lib/typescript/src/native/NitroLayoutEngine.d.ts.map +0 -1
- package/lib/typescript/src/native/NitroList.types.d.ts +0 -9
- package/lib/typescript/src/native/NitroList.types.d.ts.map +0 -1
- package/lib/typescript/src/native/NitroRecyclerView.d.ts +0 -5
- package/lib/typescript/src/native/NitroRecyclerView.d.ts.map +0 -1
- package/lib/typescript/src/specs/nitro-layout-engine.nitro.d.ts +0 -14
- package/lib/typescript/src/specs/nitro-layout-engine.nitro.d.ts.map +0 -1
- package/lib/typescript/src/viewability/ViewabilityHelper.d.ts +0 -50
- package/lib/typescript/src/viewability/ViewabilityHelper.d.ts.map +0 -1
- package/lib/typescript/src/windowing/findVisibleIndexRange.d.ts +0 -11
- package/lib/typescript/src/windowing/findVisibleIndexRange.d.ts.map +0 -1
- package/nitrogen/generated/ios/swift/HybridNitroLayoutEngineSpec.swift +0 -56
- package/src/NitroList.ts +0 -8
- package/src/RecyclerList.internal.ts +0 -38
- package/src/RecyclerList.tsx +0 -252
- package/src/RecyclerList.types.ts +0 -24
- package/src/__tests__/windowing/findVisibleIndexRange.test.ts +0 -55
- package/src/cell/StableKey.ts +0 -6
- package/src/hooks/useCellRenderer.ts +0 -86
- package/src/hooks/useStableCallback.ts +0 -13
- package/src/layout/EstimatedLayoutProvider.ts +0 -35
- package/src/layout/LayoutEngine.ts +0 -21
- package/src/layout/LayoutProvider.ts +0 -17
- package/src/layout/LayoutRectangle.ts +0 -10
- package/src/native/NitroLayoutEngine.ts +0 -7
- package/src/native/NitroList.types.ts +0 -12
- package/src/native/NitroRecyclerView.ts +0 -8
- package/src/specs/nitro-layout-engine.nitro.ts +0 -17
- package/src/viewability/ViewabilityHelper.ts +0 -130
- package/src/windowing/findVisibleIndexRange.ts +0 -60
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.useCellRenderer = useCellRenderer;
|
|
7
|
-
var _react = require("react");
|
|
8
|
-
var _CellRecycler = require("../cell/CellRecycler");
|
|
9
|
-
var _findVisibleIndexRange = require("../windowing/findVisibleIndexRange");
|
|
10
|
-
/**
|
|
11
|
-
* 🔒 Stable empty references (module-level)
|
|
12
|
-
* These MUST NOT be recreated per render.
|
|
13
|
-
*/
|
|
14
|
-
const EMPTY_INDICES = [];
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* React bridge for CellRecycler.
|
|
18
|
-
* FlashList equivalent: useCellRenderer
|
|
19
|
-
*
|
|
20
|
-
* Responsibilities:
|
|
21
|
-
* - Translate scroll state → visible indices
|
|
22
|
-
* - Ask recycler for physical cells
|
|
23
|
-
* - Commit results with referential stability
|
|
24
|
-
*
|
|
25
|
-
* Responsibilities it does NOT have:
|
|
26
|
-
* ❌ Layout mutation
|
|
27
|
-
* ❌ Measurement
|
|
28
|
-
* ❌ Rendering
|
|
29
|
-
*/
|
|
30
|
-
function useCellRenderer(layouts, metrics, bufferPx, getCellType) {
|
|
31
|
-
/**
|
|
32
|
-
* Recycler instance is stable across renders.
|
|
33
|
-
*/
|
|
34
|
-
const recyclerRef = (0, _react.useRef)(new _CellRecycler.CellRecycler());
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* Compute visible indices.
|
|
38
|
-
* PURE + TOTAL:
|
|
39
|
-
* - Never throws
|
|
40
|
-
* - Always returns the same reference when empty
|
|
41
|
-
*/
|
|
42
|
-
const visibleIndices = (0, _react.useMemo)(() => layouts.length === 0 ? EMPTY_INDICES : (0, _findVisibleIndexRange.findVisibleIndexRange)(layouts, metrics, bufferPx), [layouts, metrics.offsetY, metrics.height, bufferPx]);
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* Physical cells to render.
|
|
46
|
-
*/
|
|
47
|
-
const [cells, setCells] = (0, _react.useState)([]);
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* Reconcile visible indices → physical cells.
|
|
51
|
-
*
|
|
52
|
-
* FlashList invariant:
|
|
53
|
-
* - Only update state if identity truly changed
|
|
54
|
-
* - Prevents pointless re-renders
|
|
55
|
-
*/
|
|
56
|
-
(0, _react.useEffect)(() => {
|
|
57
|
-
const next = recyclerRef.current.reconcile(visibleIndices, getCellType);
|
|
58
|
-
setCells(prev => prev.length === next.length && prev.every((c, i) => c === next[i]) ? prev : next);
|
|
59
|
-
}, [visibleIndices, getCellType]);
|
|
60
|
-
return cells;
|
|
61
|
-
}
|
|
62
|
-
//# sourceMappingURL=useCellRenderer.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_react","require","_CellRecycler","_findVisibleIndexRange","EMPTY_INDICES","useCellRenderer","layouts","metrics","bufferPx","getCellType","recyclerRef","useRef","CellRecycler","visibleIndices","useMemo","length","findVisibleIndexRange","offsetY","height","cells","setCells","useState","useEffect","next","current","reconcile","prev","every","c","i"],"sourceRoot":"../../../src","sources":["hooks/useCellRenderer.ts"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAEA,IAAAC,aAAA,GAAAD,OAAA;AACA,IAAAE,sBAAA,GAAAF,OAAA;AAIA;AACA;AACA;AACA;AACA,MAAMG,aAAgC,GAAG,EAAE;;AAE3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,eAAeA,CAC7BC,OAAmC,EACnCC,OAAsB,EACtBC,QAAgB,EAChBC,WAAsC,EACrB;EACjB;AACF;AACA;EACE,MAAMC,WAAW,GAAG,IAAAC,aAAM,EAAe,IAAIC,0BAAY,CAAC,CAAC,CAAC;;EAE5D;AACF;AACA;AACA;AACA;AACA;EACE,MAAMC,cAAc,GAAG,IAAAC,cAAO,EAC5B,MACER,OAAO,CAACS,MAAM,KAAK,CAAC,GAChBX,aAAa,GACb,IAAAY,4CAAqB,EACnBV,OAAO,EACPC,OAAO,EACPC,QACF,CAAC,EACP,CAACF,OAAO,EAAEC,OAAO,CAACU,OAAO,EAAEV,OAAO,CAACW,MAAM,EAAEV,QAAQ,CACrD,CAAC;;EAED;AACF;AACA;EACE,MAAM,CAACW,KAAK,EAAEC,QAAQ,CAAC,GACrB,IAAAC,eAAQ,EAAkB,EAAE,CAAC;;EAE/B;AACF;AACA;AACA;AACA;AACA;AACA;EACE,IAAAC,gBAAS,EAAC,MAAM;IACd,MAAMC,IAAI,GACRb,WAAW,CAACc,OAAO,CAACC,SAAS,CAC3BZ,cAAc,EACdJ,WACF,CAAC;IAEHW,QAAQ,CAACM,IAAI,IACXA,IAAI,CAACX,MAAM,KAAKQ,IAAI,CAACR,MAAM,IAC3BW,IAAI,CAACC,KAAK,CAAC,CAACC,CAAC,EAAEC,CAAC,KAAKD,CAAC,KAAKL,IAAI,CAACM,CAAC,CAAC,CAAC,GAC/BH,IAAI,GACJH,IACN,CAAC;EACH,CAAC,EAAE,CAACV,cAAc,EAAEJ,WAAW,CAAC,CAAC;EAEjC,OAAOU,KAAK;AACd","ignoreList":[]}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.useStableCallback = useStableCallback;
|
|
7
|
-
var _react = require("react");
|
|
8
|
-
function useStableCallback(fn) {
|
|
9
|
-
const ref = (0, _react.useRef)(fn);
|
|
10
|
-
ref.current = fn;
|
|
11
|
-
return (0, _react.useCallback)((...args) => ref.current(...args), []);
|
|
12
|
-
}
|
|
13
|
-
//# sourceMappingURL=useStableCallback.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_react","require","useStableCallback","fn","ref","useRef","current","useCallback","args"],"sourceRoot":"../../../src","sources":["hooks/useStableCallback.ts"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAEO,SAASC,iBAAiBA,CAC/BC,EAAK,EACF;EACH,MAAMC,GAAG,GAAG,IAAAC,aAAM,EAACF,EAAE,CAAC;EACtBC,GAAG,CAACE,OAAO,GAAGH,EAAE;EAEhB,OAAO,IAAAI,kBAAW,EACf,CAAC,GAAGC,IAAa,KAAKJ,GAAG,CAACE,OAAO,CAAC,GAAGE,IAAI,CAAC,EAC3C,EACF,CAAC;AACH","ignoreList":[]}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.EstimatedLayoutProvider = void 0;
|
|
7
|
-
/**
|
|
8
|
-
* Layout provider using estimated item heights.
|
|
9
|
-
* Used before real measurements are available.
|
|
10
|
-
*/
|
|
11
|
-
class EstimatedLayoutProvider {
|
|
12
|
-
constructor(itemCount, itemHeight, width) {
|
|
13
|
-
this.itemCount = itemCount;
|
|
14
|
-
this.itemHeight = itemHeight;
|
|
15
|
-
this.width = width;
|
|
16
|
-
}
|
|
17
|
-
getItemCount() {
|
|
18
|
-
return this.itemCount;
|
|
19
|
-
}
|
|
20
|
-
getLayout(index) {
|
|
21
|
-
return {
|
|
22
|
-
x: 0,
|
|
23
|
-
y: index * this.itemHeight,
|
|
24
|
-
width: this.width,
|
|
25
|
-
height: this.itemHeight
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
exports.EstimatedLayoutProvider = EstimatedLayoutProvider;
|
|
30
|
-
//# sourceMappingURL=EstimatedLayoutProvider.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["EstimatedLayoutProvider","constructor","itemCount","itemHeight","width","getItemCount","getLayout","index","x","y","height","exports"],"sourceRoot":"../../../src","sources":["layout/EstimatedLayoutProvider.ts"],"mappings":";;;;;;AAGA;AACA;AACA;AACA;AACO,MAAMA,uBAAuB,CAA2B;EAK7DC,WAAWA,CACTC,SAAiB,EACjBC,UAAkB,EAClBC,KAAa,EACb;IACA,IAAI,CAACF,SAAS,GAAGA,SAAS;IAC1B,IAAI,CAACC,UAAU,GAAGA,UAAU;IAC5B,IAAI,CAACC,KAAK,GAAGA,KAAK;EACpB;EAEAC,YAAYA,CAAA,EAAW;IACrB,OAAO,IAAI,CAACH,SAAS;EACvB;EAEAI,SAASA,CAACC,KAAa,EAAmB;IACxC,OAAO;MACLC,CAAC,EAAE,CAAC;MACJC,CAAC,EAAEF,KAAK,GAAG,IAAI,CAACJ,UAAU;MAC1BC,KAAK,EAAE,IAAI,CAACA,KAAK;MACjBM,MAAM,EAAE,IAAI,CAACP;IACf,CAAC;EACH;AACF;AAACQ,OAAA,CAAAX,uBAAA,GAAAA,uBAAA","ignoreList":[]}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.computeLayouts = computeLayouts;
|
|
7
|
-
/**
|
|
8
|
-
* Resolves layouts eagerly into a contiguous array.
|
|
9
|
-
* Pure, deterministic, and reusable.
|
|
10
|
-
*
|
|
11
|
-
* FlashList equivalent: internal layout resolver.
|
|
12
|
-
*/
|
|
13
|
-
function computeLayouts(provider) {
|
|
14
|
-
const count = provider.getItemCount();
|
|
15
|
-
const layouts = new Array(count);
|
|
16
|
-
for (let i = 0; i < count; i++) {
|
|
17
|
-
layouts[i] = provider.getLayout(i);
|
|
18
|
-
}
|
|
19
|
-
return layouts;
|
|
20
|
-
}
|
|
21
|
-
//# sourceMappingURL=LayoutEngine.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["computeLayouts","provider","count","getItemCount","layouts","Array","i","getLayout"],"sourceRoot":"../../../src","sources":["layout/LayoutEngine.ts"],"mappings":";;;;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,cAAcA,CAC5BC,QAAwB,EACI;EAC5B,MAAMC,KAAK,GAAGD,QAAQ,CAACE,YAAY,CAAC,CAAC;EACrC,MAAMC,OAA0B,GAAG,IAAIC,KAAK,CAACH,KAAK,CAAC;EAEnD,KAAK,IAAII,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGJ,KAAK,EAAEI,CAAC,EAAE,EAAE;IAC9BF,OAAO,CAACE,CAAC,CAAC,GAAGL,QAAQ,CAACM,SAAS,CAACD,CAAC,CAAC;EACpC;EAEA,OAAOF,OAAO;AAChB","ignoreList":[]}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.NitroLayoutEngine = void 0;
|
|
7
|
-
var _reactNativeNitroModules = require("react-native-nitro-modules");
|
|
8
|
-
const NitroLayoutEngine = exports.NitroLayoutEngine = _reactNativeNitroModules.NitroModules.createHybridObject('NitroLayoutEngine');
|
|
9
|
-
//# sourceMappingURL=NitroLayoutEngine.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_reactNativeNitroModules","require","NitroLayoutEngine","exports","NitroModules","createHybridObject"],"sourceRoot":"../../../src","sources":["native/NitroLayoutEngine.ts"],"mappings":";;;;;;AAAA,IAAAA,wBAAA,GAAAC,OAAA;AAGO,MAAMC,iBAAiB,GAAAC,OAAA,CAAAD,iBAAA,GAC5BE,qCAAY,CAACC,kBAAkB,CAC7B,mBACF,CAAC","ignoreList":[]}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.NitroRecyclerView = void 0;
|
|
7
|
-
var _reactNative = require("react-native");
|
|
8
|
-
const NitroRecyclerView = exports.NitroRecyclerView = (0, _reactNative.requireNativeComponent)('NitroRecyclerView');
|
|
9
|
-
//# sourceMappingURL=NitroRecyclerView.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_reactNative","require","NitroRecyclerView","exports","requireNativeComponent"],"sourceRoot":"../../../src","sources":["native/NitroRecyclerView.ts"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAMO,MAAMC,iBAAiB,GAAAC,OAAA,CAAAD,iBAAA,GAC5B,IAAAE,mCAAsB,EAAyB,mBAAmB,CAAC","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":[],"sourceRoot":"../../../src","sources":["specs/nitro-layout-engine.nitro.ts"],"mappings":"","ignoreList":[]}
|
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.ViewabilityHelper = void 0;
|
|
7
|
-
/**
|
|
8
|
-
* Public token describing viewability state of an item.
|
|
9
|
-
* Mirrors FlashList's ViewToken concept.
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Configuration for viewability calculations.
|
|
14
|
-
*/
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* ViewabilityHelper
|
|
18
|
-
*
|
|
19
|
-
* Pure observer:
|
|
20
|
-
* - Does NOT affect layout
|
|
21
|
-
* - Does NOT affect recycling
|
|
22
|
-
* - Computes visibility based on layout + scroll metrics
|
|
23
|
-
*
|
|
24
|
-
* This class is intentionally stateful (lastVisible)
|
|
25
|
-
* to compute "changed" items efficiently.
|
|
26
|
-
*/
|
|
27
|
-
class ViewabilityHelper {
|
|
28
|
-
/** Previously visible indices */
|
|
29
|
-
lastVisible = new Set();
|
|
30
|
-
constructor(config = {}) {
|
|
31
|
-
this.config = config;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* Computes which items are viewable and which changed
|
|
36
|
-
* since the last invocation.
|
|
37
|
-
*
|
|
38
|
-
* IMPORTANT:
|
|
39
|
-
* - This method should be called AFTER windowing,
|
|
40
|
-
* not on the full dataset.
|
|
41
|
-
*/
|
|
42
|
-
computeViewableItems(layouts, metrics) {
|
|
43
|
-
const visibleNow = new Set();
|
|
44
|
-
const viewableItems = [];
|
|
45
|
-
const changed = [];
|
|
46
|
-
const viewportTop = metrics.offsetY;
|
|
47
|
-
const viewportBottom = viewportTop + metrics.height;
|
|
48
|
-
|
|
49
|
-
// Normalize threshold into [0, 1]
|
|
50
|
-
const threshold = (this.config.itemVisiblePercentThreshold ?? 0) / 100;
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* NOTE:
|
|
54
|
-
* We intentionally iterate layouts sequentially,
|
|
55
|
-
* but EXIT EARLY when items are completely below viewport.
|
|
56
|
-
*
|
|
57
|
-
* This keeps complexity near O(visibleItems),
|
|
58
|
-
* not O(totalItems).
|
|
59
|
-
*/
|
|
60
|
-
for (let i = 0; i < layouts.length; i++) {
|
|
61
|
-
const layout = layouts[i];
|
|
62
|
-
|
|
63
|
-
// If item is completely below viewport, stop
|
|
64
|
-
if (layout.y > viewportBottom) {
|
|
65
|
-
break;
|
|
66
|
-
}
|
|
67
|
-
const itemTop = layout.y;
|
|
68
|
-
const itemBottom = layout.y + layout.height;
|
|
69
|
-
|
|
70
|
-
// If item is completely above viewport, skip
|
|
71
|
-
if (itemBottom < viewportTop) {
|
|
72
|
-
continue;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
// Compute visible intersection
|
|
76
|
-
const visibleTop = Math.max(itemTop, viewportTop);
|
|
77
|
-
const visibleBottom = Math.min(itemBottom, viewportBottom);
|
|
78
|
-
const visibleHeight = Math.max(0, visibleBottom - visibleTop);
|
|
79
|
-
|
|
80
|
-
// Guard against zero-height items
|
|
81
|
-
const itemHeight = layout.height > 0 ? layout.height : 1;
|
|
82
|
-
const visibleRatio = visibleHeight / itemHeight;
|
|
83
|
-
if (visibleRatio >= threshold) {
|
|
84
|
-
visibleNow.add(i);
|
|
85
|
-
viewableItems.push({
|
|
86
|
-
index: i,
|
|
87
|
-
isViewable: true
|
|
88
|
-
});
|
|
89
|
-
|
|
90
|
-
// Newly visible
|
|
91
|
-
if (!this.lastVisible.has(i)) {
|
|
92
|
-
changed.push({
|
|
93
|
-
index: i,
|
|
94
|
-
isViewable: true
|
|
95
|
-
});
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
/**
|
|
101
|
-
* Items that were visible before but not anymore
|
|
102
|
-
*/
|
|
103
|
-
for (const index of this.lastVisible) {
|
|
104
|
-
if (!visibleNow.has(index)) {
|
|
105
|
-
changed.push({
|
|
106
|
-
index,
|
|
107
|
-
isViewable: false
|
|
108
|
-
});
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
// Update snapshot
|
|
113
|
-
this.lastVisible = visibleNow;
|
|
114
|
-
return {
|
|
115
|
-
viewableItems,
|
|
116
|
-
changed
|
|
117
|
-
};
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
exports.ViewabilityHelper = ViewabilityHelper;
|
|
121
|
-
//# sourceMappingURL=ViewabilityHelper.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["ViewabilityHelper","lastVisible","Set","constructor","config","computeViewableItems","layouts","metrics","visibleNow","viewableItems","changed","viewportTop","offsetY","viewportBottom","height","threshold","itemVisiblePercentThreshold","i","length","layout","y","itemTop","itemBottom","visibleTop","Math","max","visibleBottom","min","visibleHeight","itemHeight","visibleRatio","add","push","index","isViewable","has","exports"],"sourceRoot":"../../../src","sources":["viewability/ViewabilityHelper.ts"],"mappings":";;;;;;AAGA;AACA;AACA;AACA;;AAMA;AACA;AACA;;AASA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMA,iBAAiB,CAAC;EAC7B;EACQC,WAAW,GAAG,IAAIC,GAAG,CAAS,CAAC;EAEvCC,WAAWA,CACQC,MAAyB,GAAG,CAAC,CAAC,EAC/C;IAAA,KADiBA,MAAyB,GAAzBA,MAAyB;EACzC;;EAEH;AACF;AACA;AACA;AACA;AACA;AACA;AACA;EACEC,oBAAoBA,CAClBC,OAAmC,EACnCC,OAAsB,EAItB;IACA,MAAMC,UAAU,GAAG,IAAIN,GAAG,CAAS,CAAC;IACpC,MAAMO,aAA0B,GAAG,EAAE;IACrC,MAAMC,OAAoB,GAAG,EAAE;IAE/B,MAAMC,WAAW,GAAGJ,OAAO,CAACK,OAAO;IACnC,MAAMC,cAAc,GAAGF,WAAW,GAAGJ,OAAO,CAACO,MAAM;;IAEnD;IACA,MAAMC,SAAS,GACb,CAAC,IAAI,CAACX,MAAM,CAACY,2BAA2B,IAAI,CAAC,IAAI,GAAG;;IAEtD;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;IACI,KAAK,IAAIC,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGX,OAAO,CAACY,MAAM,EAAED,CAAC,EAAE,EAAE;MACvC,MAAME,MAAM,GAAGb,OAAO,CAACW,CAAC,CAAE;;MAE1B;MACA,IAAIE,MAAM,CAACC,CAAC,GAAGP,cAAc,EAAE;QAC7B;MACF;MAEA,MAAMQ,OAA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,aAAa;MAAEC;IAAQ,CAAC;EACnC;AACF;AAAC0B,OAAA,CAAApC,iBAAA,GAAAA,iBAAA","ignoreList":[]}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.findVisibleIndexRange = findVisibleIndexRange;
|
|
7
|
-
/**
|
|
8
|
-
* Computes the contiguous range of item indices
|
|
9
|
-
* intersecting the viewport expanded by bufferPx.
|
|
10
|
-
*
|
|
11
|
-
* PURE function. No allocations besides output.
|
|
12
|
-
* FlashList-style windowing.
|
|
13
|
-
*/
|
|
14
|
-
function findVisibleIndexRange(layouts, metrics, bufferPx) {
|
|
15
|
-
const count = layouts.length;
|
|
16
|
-
|
|
17
|
-
// 🔒 CRITICAL GUARDS (FlashList-style)
|
|
18
|
-
if (count === 0 || metrics.height <= 0 || bufferPx < 0) {
|
|
19
|
-
return [];
|
|
20
|
-
}
|
|
21
|
-
const windowStart = Math.max(0, metrics.offsetY - bufferPx);
|
|
22
|
-
const windowEnd = metrics.offsetY + metrics.height + bufferPx;
|
|
23
|
-
|
|
24
|
-
// Binary search for first intersecting item
|
|
25
|
-
let low = 0;
|
|
26
|
-
let high = count - 1;
|
|
27
|
-
let firstVisible = count;
|
|
28
|
-
while (low <= high) {
|
|
29
|
-
const mid = low + high >> 1;
|
|
30
|
-
const rect = layouts[mid];
|
|
31
|
-
if (rect.y + rect.height >= windowStart) {
|
|
32
|
-
firstVisible = mid;
|
|
33
|
-
high = mid - 1;
|
|
34
|
-
} else {
|
|
35
|
-
low = mid + 1;
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
// Linear scan forward
|
|
40
|
-
const visible = [];
|
|
41
|
-
for (let i = firstVisible; i < count; i++) {
|
|
42
|
-
const rect = layouts[i];
|
|
43
|
-
if (rect.y > windowEnd) break;
|
|
44
|
-
visible.push(i);
|
|
45
|
-
}
|
|
46
|
-
return visible;
|
|
47
|
-
}
|
|
48
|
-
//# sourceMappingURL=findVisibleIndexRange.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["findVisibleIndexRange","layouts","metrics","bufferPx","count","length","height","windowStart","Math","max","offsetY","windowEnd","low","high","firstVisible","mid","rect","y","visible","i","push"],"sourceRoot":"../../../src","sources":["windowing/findVisibleIndexRange.ts"],"mappings":";;;;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,qBAAqBA,CACnCC,OAAmC,EACnCC,OAAsB,EACtBC,QAAgB,EACG;EACnB,MAAMC,KAAK,GAAGH,OAAO,CAACI,MAAM;;EAE5B;EACA,IACED,KAAK,KAAK,CAAC,IACXF,OAAO,CAACI,MAAM,IAAI,CAAC,IACnBH,QAAQ,GAAG,CAAC,EACZ;IACA,OAAO,EAAE;EACX;EAEA,MAAMI,WAAW,GACfC,IAAI,CAACC,GAAG,CAAC,CAAC,EAAEP,OAAO,CAACQ,OAAO,GAAGP,QAAQ,CAAC;EAEzC,MAAMQ,SAAS,GACbT,OAAO,CAACQ,OAAO,GAAGR,OAAO,CAACI,MAAM,GAAGH,QAAQ;;EAE7C;EACA,IAAIS,GAAG,GAAG,CAAC;EACX,IAAIC,IAAI,GAAGT,KAAK,GAAG,CAAC;EACpB,IAAIU,YAAY,GAAGV,KAAK;EAExB,OAAOQ,GAAG,IAAIC,IAAI,EAAE;IAClB,MAAME,GAAG,GAAIH,GAAG,GAAGC,IAAI,IAAK,CAAC;IAC7B,MAAMG,IAAI,GAAGf,OAAO,CAACc,GAAG,CAAE;IAE1B,IAAIC,IAAI,CAACC,CAAC,GAAGD,IAAI,CAACV,MAAM,IAAIC,WAAW,EAAE;MACvCO,YAAY,GAAGC,GAAG;MAClBF,IAAI,GAAGE,GAAG,GAAG,CAAC;IAChB,CAAC,MAAM;MACLH,GAAG,GAAGG,GAAG,GAAG,CAAC;IACf;EACF;;EAEA;EACA,MAAMG,OAAiB,GAAG,EAAE;EAE5B,KAAK,IAAIC,CAAC,GAAGL,YAAY,EAAEK,CAAC,GAAGf,KAAK,EAAEe,CAAC,EAAE,EAAE;IACzC,MAAMH,IAAI,GAAGf,OAAO,CAACkB,CAAC,CAAE;IACxB,IAAIH,IAAI,CAACC,CAAC,GAAGN,SAAS,EAAE;IACxBO,OAAO,CAACE,IAAI,CAACD,CAAC,CAAC;EACjB;EAEA,OAAOD,OAAO;AAChB","ignoreList":[]}
|
package/lib/module/NitroList.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["requireNativeComponent","NitroRecyclerView"],"sourceRoot":"../../src","sources":["NitroList.ts"],"mappings":";;AAAA,SAASA,sBAAsB,QAAQ,cAAc;AAMrD,OAAO,MAAMC,iBAAiB,GAC5BD,sBAAsB,CAAyB,mBAAmB,CAAC","ignoreList":[]}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
import { useCellRenderer } from './hooks/useCellRenderer';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* INTERNAL hook.
|
|
7
|
-
* MUST ALWAYS CALL hooks in the same order.
|
|
8
|
-
*/
|
|
9
|
-
export function useRecyclerListInternal(layouts, metrics, bufferPx, getItemType) {
|
|
10
|
-
/**
|
|
11
|
-
* FlashList rule:
|
|
12
|
-
* Hooks are ALWAYS called.
|
|
13
|
-
* Inputs are guarded instead.
|
|
14
|
-
*/
|
|
15
|
-
const safeLayouts = metrics.height > 0 ? layouts : EMPTY_LAYOUTS;
|
|
16
|
-
const safeBufferPx = metrics.height > 0 ? bufferPx : 0;
|
|
17
|
-
return useCellRenderer(safeLayouts, metrics, safeBufferPx, getItemType);
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
/** Stable empty reference */
|
|
21
|
-
const EMPTY_LAYOUTS = [];
|
|
22
|
-
//# sourceMappingURL=RecyclerList.internal.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["useCellRenderer","useRecyclerListInternal","layouts","metrics","bufferPx","getItemType","safeLayouts","height","EMPTY_LAYOUTS","safeBufferPx"],"sourceRoot":"../../src","sources":["RecyclerList.internal.ts"],"mappings":";;AAIA,SAASA,eAAe,QAAQ,yBAAyB;;AAEzD;AACA;AACA;AACA;AACA,OAAO,SAASC,uBAAuBA,CACrCC,OAAmC,EACnCC,OAAsB,EACtBC,QAAgB,EAChBC,WAAsC,EACrB;EAEjB;AACF;AACA;AACA;AACA;EACE,MAAMC,WAAW,GACfH,OAAO,CAACI,MAAM,GAAG,CAAC,GAAGL,OAAO,GAAGM,aAAa;EAE9C,MAAMC,YAAY,GAChBN,OAAO,CAACI,MAAM,GAAG,CAAC,GAAGH,QAAQ,GAAG,CAAC;EAEnC,OAAOJ,eAAe,CACpBM,WAAW,EACXH,OAAO,EACPM,YAAY,EACZJ,WACF,CAAC;AACH;;AAEA;AACA,MAAMG,aAAyC,GAAG,EAAE","ignoreList":[]}
|
|
@@ -1,166 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
import React, { useMemo, useRef, useEffect } from 'react';
|
|
4
|
-
import { ScrollView, View, StyleSheet } from 'react-native';
|
|
5
|
-
import { useRecyclerListInternal } from './RecyclerList.internal';
|
|
6
|
-
import { useScrollMetrics } from './windowing';
|
|
7
|
-
import { MutableLinearLayout } from './layout/MutableLinearLayout';
|
|
8
|
-
import { ViewabilityHelper } from './viewability/ViewabilityHelper';
|
|
9
|
-
import { PrefetchHelper } from './prefetch/PrefetchHelper';
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Public API — mirrors FlashList behavior, not internals.
|
|
13
|
-
*/
|
|
14
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
15
|
-
/**
|
|
16
|
-
* FlashList invariant:
|
|
17
|
-
* Never allow viewport height = 0 to gate windowing.
|
|
18
|
-
*/
|
|
19
|
-
const DEFAULT_VIEWPORT_HEIGHT = 800;
|
|
20
|
-
export function RecyclerList(props) {
|
|
21
|
-
const {
|
|
22
|
-
containerWidth,
|
|
23
|
-
itemCount,
|
|
24
|
-
itemHeights,
|
|
25
|
-
estimatedItemHeight = 80,
|
|
26
|
-
renderBufferRatio = 1.3,
|
|
27
|
-
getItemType = () => 'default',
|
|
28
|
-
renderItem,
|
|
29
|
-
onPrefetch,
|
|
30
|
-
onViewableItemsChanged
|
|
31
|
-
} = props;
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* 🚨 DEV WARNINGS ONLY (never throw in render!)
|
|
35
|
-
*/
|
|
36
|
-
if (__DEV__) {
|
|
37
|
-
if (!itemHeights && itemCount == null) {
|
|
38
|
-
console.error('RecyclerList requires either itemCount or itemHeights.');
|
|
39
|
-
}
|
|
40
|
-
if (itemHeights && itemCount != null) {
|
|
41
|
-
console.error('Provide only one of itemCount or itemHeights.');
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* STEP 1: Resolve item count safely (props only).
|
|
47
|
-
* Never depend on hooks for structural decisions.
|
|
48
|
-
*/
|
|
49
|
-
const itemLength = itemHeights?.length ?? itemCount ?? 0;
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
* STEP 2: Resolve initial heights (always defined).
|
|
53
|
-
*/
|
|
54
|
-
const resolvedHeights = useMemo(() => {
|
|
55
|
-
if (itemHeights) return itemHeights;
|
|
56
|
-
return Array.from({
|
|
57
|
-
length: itemLength
|
|
58
|
-
}, () => estimatedItemHeight);
|
|
59
|
-
}, [itemHeights, itemLength, estimatedItemHeight]);
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
* STEP 3: Mutable layout lifecycle.
|
|
63
|
-
* Recreate layout only when shape changes.
|
|
64
|
-
*/
|
|
65
|
-
const layoutRef = useRef(null);
|
|
66
|
-
const lastLayoutKeyRef = useRef(null);
|
|
67
|
-
const layoutKey = `${containerWidth}-${itemLength}`;
|
|
68
|
-
if (!layoutRef.current || lastLayoutKeyRef.current !== layoutKey) {
|
|
69
|
-
layoutRef.current = new MutableLinearLayout(resolvedHeights, containerWidth);
|
|
70
|
-
lastLayoutKeyRef.current = layoutKey;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
/**
|
|
74
|
-
* STEP 4: Read layout snapshot.
|
|
75
|
-
*/
|
|
76
|
-
const layouts = layoutRef.current.getLayouts();
|
|
77
|
-
const contentHeight = layoutRef.current.getContentHeight();
|
|
78
|
-
|
|
79
|
-
/**
|
|
80
|
-
* STEP 5: Scroll metrics.
|
|
81
|
-
*/
|
|
82
|
-
const {
|
|
83
|
-
metrics,
|
|
84
|
-
onScroll,
|
|
85
|
-
onLayout
|
|
86
|
-
} = useScrollMetrics();
|
|
87
|
-
|
|
88
|
-
/**
|
|
89
|
-
* STEP 6: Guard initial windowing.
|
|
90
|
-
*/
|
|
91
|
-
const effectiveViewportHeight = metrics.height > 0 ? metrics.height : DEFAULT_VIEWPORT_HEIGHT;
|
|
92
|
-
const bufferPx = effectiveViewportHeight * renderBufferRatio;
|
|
93
|
-
|
|
94
|
-
/**
|
|
95
|
-
* STEP 7: Windowing + recycling.
|
|
96
|
-
*/
|
|
97
|
-
const cells = useRecyclerListInternal(layouts, metrics, bufferPx, getItemType);
|
|
98
|
-
|
|
99
|
-
/**
|
|
100
|
-
* STEP 8: Phase-1 observers.
|
|
101
|
-
*/
|
|
102
|
-
const viewabilityRef = useRef(new ViewabilityHelper({
|
|
103
|
-
itemVisiblePercentThreshold: 50
|
|
104
|
-
}));
|
|
105
|
-
const prefetchRef = useRef(new PrefetchHelper());
|
|
106
|
-
useEffect(() => {
|
|
107
|
-
prefetchRef.current = new PrefetchHelper();
|
|
108
|
-
}, [itemLength]);
|
|
109
|
-
useEffect(() => {
|
|
110
|
-
if (metrics.height === 0) return;
|
|
111
|
-
if (onViewableItemsChanged) {
|
|
112
|
-
const visibleLayouts = [];
|
|
113
|
-
for (const cell of cells) {
|
|
114
|
-
const layout = layouts[cell.index];
|
|
115
|
-
if (layout) visibleLayouts.push(layout);
|
|
116
|
-
}
|
|
117
|
-
const info = viewabilityRef.current.computeViewableItems(visibleLayouts, metrics);
|
|
118
|
-
onViewableItemsChanged(info);
|
|
119
|
-
}
|
|
120
|
-
if (onPrefetch && itemLength > 0) {
|
|
121
|
-
prefetchRef.current.runPrefetch(cells.map(c => c.index), itemLength, 5, onPrefetch);
|
|
122
|
-
}
|
|
123
|
-
}, [cells, metrics.offsetY, metrics.height, onViewableItemsChanged, onPrefetch, itemLength, layouts]);
|
|
124
|
-
|
|
125
|
-
/**
|
|
126
|
-
* STEP 9: Render absolutely positioned cells.
|
|
127
|
-
*/
|
|
128
|
-
return /*#__PURE__*/_jsx(ScrollView, {
|
|
129
|
-
style: styles.container,
|
|
130
|
-
onLayout: onLayout,
|
|
131
|
-
onScroll: onScroll,
|
|
132
|
-
scrollEventThrottle: 16,
|
|
133
|
-
removeClippedSubviews: true,
|
|
134
|
-
children: /*#__PURE__*/_jsx(View, {
|
|
135
|
-
style: [styles.content, {
|
|
136
|
-
height: contentHeight
|
|
137
|
-
}],
|
|
138
|
-
children: cells.map(cell => {
|
|
139
|
-
const layout = layouts[cell.index];
|
|
140
|
-
if (!layout) return null;
|
|
141
|
-
return /*#__PURE__*/_jsx(View, {
|
|
142
|
-
style: [styles.cell, {
|
|
143
|
-
top: layout.y,
|
|
144
|
-
width: layout.width,
|
|
145
|
-
height: layout.height
|
|
146
|
-
}],
|
|
147
|
-
children: renderItem(cell.index)
|
|
148
|
-
}, cell.key);
|
|
149
|
-
})
|
|
150
|
-
})
|
|
151
|
-
});
|
|
152
|
-
}
|
|
153
|
-
const styles = StyleSheet.create({
|
|
154
|
-
container: {
|
|
155
|
-
flex: 1
|
|
156
|
-
},
|
|
157
|
-
content: {
|
|
158
|
-
position: 'relative',
|
|
159
|
-
width: '100%'
|
|
160
|
-
},
|
|
161
|
-
cell: {
|
|
162
|
-
position: 'absolute',
|
|
163
|
-
left: 0
|
|
164
|
-
}
|
|
165
|
-
});
|
|
166
|
-
//# sourceMappingURL=RecyclerList.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["React","useMemo","useRef","useEffect","ScrollView","View","StyleSheet","useRecyclerListInternal","useScrollMetrics","MutableLinearLayout","ViewabilityHelper","PrefetchHelper","jsx","_jsx","DEFAULT_VIEWPORT_HEIGHT","RecyclerList","props","containerWidth","itemCount","itemHeights","estimatedItemHeight","renderBufferRatio","getItemType","renderItem","onPrefetch","onViewableItemsChanged","__DEV__","console","error","itemLength","length","resolvedHeights","Array","from","layoutRef","lastLayoutKeyRef","layoutKey","current","layouts","getLayouts","contentHeight","getContentHeight","metrics","onScroll","onLayout","effectiveViewportHeight","height","bufferPx","cells","viewabilityRef","itemVisiblePercentThreshold","prefetchRef","visibleLayouts","cell","layout","index","push","info","computeViewableItems","runPrefetch","map","c","offsetY","style","styles","container","scrollEventThrottle","removeClippedSubviews","children","content","top","y","width","key","create","flex","position","left"],"sourceRoot":"../../src","sources":["RecyclerList.tsx"],"mappings":";;AAAA,OAAOA,KAAK,IACVC,OAAO,EACPC,MAAM,EACNC,SAAS,QACJ,OAAO;AACd,SACEC,UAAU,EACVC,IAAI,EACJC,UAAU,QACL,cAAc;AAKrB,SAASC,uBAAuB,QAAQ,yBAAyB;AACjE,SAASC,gBAAgB,QAAQ,aAAa;AAC9C,SAASC,mBAAmB,QAAQ,8BAA8B;AAClE,SAASC,iBAAiB,QAAQ,iCAAiC;AACnE,SAASC,cAAc,QAAQ,2BAA2B;;AAE1D;AACA;AACA;AAFA,SAAAC,GAAA,IAAAC,IAAA;AAkBA;AACA;AACA;AACA;AACA,MAAMC,uBAAuB,GAAG,GAAG;AAEnC,OAAO,SAASC,YAAYA,CAACC,KAAwB,EAAsB;EACzE,MAAM;IACJC,cAAc;IACdC,SAAS;IACTC,WAAW;IACXC,mBAAmB,GAAG,EAAE;IACxBC,iBAAiB,GAAG,GAAG;IACvB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CAAC;EACtBN,OAAO,EAAE;IAAEO,QAAQ,EAAE,UAAU;IAAEJ,KAAK,EAAE;EAAO,CAAC;EAChDnB,IAAI,EAAE;IAAEuB,QAAQ,EAAE,UAAU;IAAEC,IAAI,EAAE;EAAE;AACxC,CAAC,CAAC","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":[],"sourceRoot":"../../src","sources":["RecyclerList.types.ts"],"mappings":"","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["getStableKey","slotKey","index"],"sourceRoot":"../../../src","sources":["cell/StableKey.ts"],"mappings":";;AAAA,OAAO,SAASA,YAAYA,CAC1BC,OAAe,EACfC,KAAa,EACL;EACR,OAAO,GAAGD,OAAO,IAAIC,KAAK,EAAE;AAC9B","ignoreList":[]}
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
import { useEffect, useMemo, useRef, useState } from 'react';
|
|
4
|
-
import { CellRecycler } from '../cell/CellRecycler';
|
|
5
|
-
import { findVisibleIndexRange } from '../windowing/findVisibleIndexRange';
|
|
6
|
-
/**
|
|
7
|
-
* 🔒 Stable empty references (module-level)
|
|
8
|
-
* These MUST NOT be recreated per render.
|
|
9
|
-
*/
|
|
10
|
-
const EMPTY_INDICES = [];
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* React bridge for CellRecycler.
|
|
14
|
-
* FlashList equivalent: useCellRenderer
|
|
15
|
-
*
|
|
16
|
-
* Responsibilities:
|
|
17
|
-
* - Translate scroll state → visible indices
|
|
18
|
-
* - Ask recycler for physical cells
|
|
19
|
-
* - Commit results with referential stability
|
|
20
|
-
*
|
|
21
|
-
* Responsibilities it does NOT have:
|
|
22
|
-
* ❌ Layout mutation
|
|
23
|
-
* ❌ Measurement
|
|
24
|
-
* ❌ Rendering
|
|
25
|
-
*/
|
|
26
|
-
export function useCellRenderer(layouts, metrics, bufferPx, getCellType) {
|
|
27
|
-
/**
|
|
28
|
-
* Recycler instance is stable across renders.
|
|
29
|
-
*/
|
|
30
|
-
const recyclerRef = useRef(new CellRecycler());
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* Compute visible indices.
|
|
34
|
-
* PURE + TOTAL:
|
|
35
|
-
* - Never throws
|
|
36
|
-
* - Always returns the same reference when empty
|
|
37
|
-
*/
|
|
38
|
-
const visibleIndices = useMemo(() => layouts.length === 0 ? EMPTY_INDICES : findVisibleIndexRange(layouts, metrics, bufferPx), [layouts, metrics.offsetY, metrics.height, bufferPx]);
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* Physical cells to render.
|
|
42
|
-
*/
|
|
43
|
-
const [cells, setCells] = useState([]);
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* Reconcile visible indices → physical cells.
|
|
47
|
-
*
|
|
48
|
-
* FlashList invariant:
|
|
49
|
-
* - Only update state if identity truly changed
|
|
50
|
-
* - Prevents pointless re-renders
|
|
51
|
-
*/
|
|
52
|
-
useEffect(() => {
|
|
53
|
-
const next = recyclerRef.current.reconcile(visibleIndices, getCellType);
|
|
54
|
-
setCells(prev => prev.length === next.length && prev.every((c, i) => c === next[i]) ? prev : next);
|
|
55
|
-
}, [visibleIndices, getCellType]);
|
|
56
|
-
return cells;
|
|
57
|
-
}
|
|
58
|
-
//# sourceMappingURL=useCellRenderer.js.map
|